I was bite by this:
#!/usr/bin/env perl use strict; use warnings;
my @stuff = sort returns_list('whatever'); print "stuff: [@stuff]\n";
@stuff = returns_list('again'); @stuff = sort @stuff; print "stuff: [@stuff]\n";
sub returns_list { return qw( howdy all of you ); }
__END__
poletti@PolettiX:tmp$ /opt/perl-5.8.8/bin/perl bug.pl stuff: [whatever] stuff: [all howdy of you] poletti@PolettiX:tmp$ /opt/perl-5.10.0/bin/perl bug.pl stuff: [whatever] stuff: [all howdy of you]
$ perl -MO=Deparse sort_bug.pl use warnings; use strict 'refs'; my(@stuff) = (sort returns_list 'whatever'); print "stuff: [@stuff]\n"; @stuff = returns_list('again'); @stuff = sort @stuff; print "stuff: [@stuff]\n"; sub returns_list { use warnings; use strict 'refs'; return 'howdy', 'all', 'of', 'you'; }
sort BLOCK LIST
.