Thread Parameter und Subroutinen (Prototypen, Referenzen?!)
(15 answers)
Opened by Bob at 2011-05-21 10:48
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 |