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

Popular posts from this blog

hibernate - How to load global settings frequently used in application in Java -

python 3.x - Mapping specific letters onto a list of words -

objective c - Ownership modifiers with manual reference counting -