in reply to C<while> magic also working with glob(): intentional or not?
That's definitely code you don't want to be using in production. You're taking a list of items, joining them with whitespace (techically, with $" which makes this even more broken), then running the glob operator on them. That expands them as filenames, but of course uses the space delimiters to separate the names. Then, the resulting list is either returned in entirity (in a list context), or doled out one-by-one in a scalar context, as you have here.@a=qw/a b c/; print while <@a>
So, this is really really not the right way to walk through a list of items. It breaks when any of the following are true:
Definitely want to steer-far-clear of code like this.
-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: C<while> magic also working with glob(): intentional or not?
by Util (Priest) on Sep 27, 2005 at 18:43 UTC | |
|
Re^2: C<while> magic also working with glob(): intentional or not?
by blazar (Canon) on Sep 28, 2005 at 08:39 UTC |