Hi
This will do what you want:-

perl -le '@test=(1,2,3,4,5);print join "\n",@test;'

The -l option ensures a final newline after the last element of the array is printed. The order of the options is important as changing it to "el" wouldn't work.

--
Andrew
Edinburgh,Scotland

On Thu, 25 Oct 2007, Ron Bergin wrote:

On Oct 25, 1:59 am, [EMAIL PROTECTED] (Irfan Sayed) 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

now my req. is that I want to store these array values in another array
in such a fashion where I can print like
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

I have used push function also but it is not giving expected result.

Please guide.

Regards
Irfan.

print $_,$/ for @test;




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to