Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

polettix (7564)

polettix
  (email not shown publicly)
http://www.polettix.it/

Journal of polettix (7564)

Friday January 11, 2008
05:59 AM

sort SUBNAME LIST is sick

[ #35360 ]

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]

which is regarded as (thanks dakkar):

$ 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';
}

dakkar also reminded me that this was the only way to support what then became sort BLOCK LIST.

This is just sick.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.