sfink has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to separate a list of MP3 files into two groups: the ones matching /ad/ and the rest.
I am puzzled why this works:
while this does not:perl -le 'push @{$f[/ad/]}, $_ foreach glob("*.mp3"); use Data::Dumper +; print Dumper(\@f)'
The latter puts everything into $f[0], matching or not.perl -le '@f = glob("*.mp3"); push @{$f[/ad/]}, $_ foreach @f; use Dat +a::Dumper; print Dumper(\@f)'
This is perl, v5.10.0 built for i386-linux-thread-multi
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: push foreach glob - bug?
by ikegami (Patriarch) on Jan 13, 2010 at 22:56 UTC | |
by sfink (Deacon) on Jan 14, 2010 at 01:05 UTC | |
by ikegami (Patriarch) on Jan 14, 2010 at 02:00 UTC | |
Re: push foreach glob - bug?
by shmem (Chancellor) on Jan 13, 2010 at 22:54 UTC | |
by ikegami (Patriarch) on Jan 13, 2010 at 22:58 UTC | |
by shmem (Chancellor) on Jan 13, 2010 at 23:10 UTC |
Back to
Seekers of Perl Wisdom