Thread Parameter und Subroutinen (Prototypen, Referenzen?!) (15 answers)
Opened by Bob at 2011-05-21 10:48

rosti
 2011-05-21 13:03
#148963 #148963
User since
2011-03-19
3472 Artikel
BenutzerIn
[Homepage]
user image
Meine Variante:

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Delimiter and Array
my $ref = {
        DEL => ';',
        ARR => [1,2,3,4,5],
};

my $str = array_to_string($ref) or die "no delimiter is given";
print $str;


sub array_to_string{
        my $ref = shift;
        if(exists $ref->{DEL}){
                return join($ref->{DEL}, @{$ref->{ARR}});
        }
        else{ return }
}
# 1;2;3;4;5

View full thread Parameter und Subroutinen (Prototypen, Referenzen?!)