I don't particularly think that while (<@array>){....} is sensible code it was just a fragment of what I have tried. I use foreach more often than not. But out of curiousity why do you refer to the while(<@array>) {...} as awful code?
"No matter where you go, there you are." BB
| [reply] |
It uses <...> in its file-globbing context. This means any elements in @array that contain wildcard characters for your shell will be expanded into all matching filenames. It also means that if any of your elements have whitespace in them, they'll be split on that whitespace.
@array = ("this", "is not", "cool");
print "[$_]" while <@array>; # [this][is][not][cool]
It's misuse of an operator, and I'm irked that Perl lets it fly without even alerting you to the potential gaffe you're making.
_____________________________________________________
Jeff japhy Pinyan,
P.L., P.M., P.O.D, X.S.:
Perl,
regex,
and perl
hacker
How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart
| [reply] [d/l] [select] |