in reply to array join missing zero and space
join is used to create a field separator (opposite: split )
code:
my $a='4,7,11,14'; print join(',',split(',',$a));
result:
4,7,11,14
code:
my @numbers=(4,7,11,14); my $start='0 '; my $middle=' 0 '; my $end="\n"; print $start,join("$middle",@numbers),$end;
result:
0 4 0 7 0 11 0 14
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: array join missing zero and space
by jimmy.tty (Scribe) on Jul 05, 2011 at 18:18 UTC |