put handles <> on your array: while(my $item = <@array>) { print("$item\n"); }
Although this works in this particular case, I wouldn't recommend it: The <> actually doesn't do anything with "handles" (like <$filehandle>, which is readline), instead it's glob in disguise, and glob has several caveats. I would suggest a regular foreach, or perhaps each (Perl >= 5.12, which was not available in 2007, at the time of this thread).
$ perl -MO=Deparse -e 'while(my $item = <@array>) { print "$item\n" }'
while (defined(my $item = glob(join $", @array))) {
do {
use File::Glob ();
print "$item\n"
};
}
|