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

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

javascript - jquery or ashx not working -

inno setup - TLabel or TNewStaticText - change .Font.Style on Focus like Cursor changes with .Cursor -