Print array with newlines in perl -
i trying print array containing strings representing text lines.
consider:
my $a="1\n2\n3\n"; @b=split(/^/, $a); $,=""; print "@b";
this gives output:
1 2 3
notice space in front of second , third line. reason space, , how rid of it?
if don't want space, use for
loop.
print @b
or can edit $list_separator
, $"
defined in perlvar
, default space.
local $" = ''; print "@b";
Comments
Post a Comment