M
Mark Day
Any tips on what I'm doing wrong here appreciated.
I'm using perl version 5.6.1 on Win98,
and this test script i've written, I was hoping would print each element
of this array, on a new line, then print the array again in reverse order.
What actually output's is the same array twice with all elements printed
on the same line.
What is wrong with my attempt to reverse the array, adn why does each
scalar not print on a new line?
thanks.
--code snippet---
#!C:\perl\bin\perl
@array = qq(1 2 3 4 5 6 7 8 9 10 11 12 baker's dozen);
foreach (@array)
{
print $_;
print "\n";
}
@array = reverse @array;
foreach (@array) {
print $_;
print "\n";
}
I'm using perl version 5.6.1 on Win98,
and this test script i've written, I was hoping would print each element
of this array, on a new line, then print the array again in reverse order.
What actually output's is the same array twice with all elements printed
on the same line.
What is wrong with my attempt to reverse the array, adn why does each
scalar not print on a new line?
thanks.
--code snippet---
#!C:\perl\bin\perl
@array = qq(1 2 3 4 5 6 7 8 9 10 11 12 baker's dozen);
foreach (@array)
{
print $_;
print "\n";
}
@array = reverse @array;
foreach (@array) {
print $_;
print "\n";
}