http://qs321.pair.com?node_id=817298

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:

perl -le 'push @{$f[/ad/]}, $_ foreach glob("*.mp3"); use Data::Dumper +; print Dumper(\@f)'
while this does not:
perl -le '@f = glob("*.mp3"); push @{$f[/ad/]}, $_ foreach @f; use Dat +a::Dumper; print Dumper(\@f)'
The latter puts everything into $f[0], matching or not.
This is perl, v5.10.0 built for i386-linux-thread-multi