printing array problem
From: Mark Day (soundz_at_techie.com)
Date: 09/28/04
- Next message: David Frauzel: "Re: Precedence of exponentiation"
- Previous message: Joe Smith: "Re: Loop through scalar?"
- Next in thread: Mark Clements: "Re: printing array problem"
- Reply: Mark Clements: "Re: printing array problem"
- Reply: Anno Siegel: "Re: printing array problem"
- Reply: Graham Wood: "Re: printing array problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 28 Sep 2004 00:56:35 -0700
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";
}
- Next message: David Frauzel: "Re: Precedence of exponentiation"
- Previous message: Joe Smith: "Re: Loop through scalar?"
- Next in thread: Mark Clements: "Re: printing array problem"
- Reply: Mark Clements: "Re: printing array problem"
- Reply: Anno Siegel: "Re: printing array problem"
- Reply: Graham Wood: "Re: printing array problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|