On 25 Oct 2007, at 4:59 PM, Sayed, Irfan (Irfan) wrote:
Hi All,
I have one array say my @test=(1,2,3,4,5);
if I print this array it will print like this
print "@test\n";
and the output is
1 2 3 4 5
so I mean to say that if I type print "@test1\n";
then output should come as
1
2
3
4
5
Try map:
my @test1 = map($_."\n", @test);
print @test1, "\n";
Note that if you use print "@test1\n", Perl will insert a space after
each element, this means that you will actually get:
1
2
3
4
5
Alternatively, if you simply need to print each element of @test with
a newline after it:
print $_, "\n" foreach @test;
print "\n";
HTH.
--
dwu
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/