in reply to Numeric Sort for Stringified Value (How to Avoid Warning)

Instead of running perl with the -w switch, use warnings; and turn off the particular warning in a scope. That needs Perl 5.6+.

$ perl -Mwarnings -MData::Dumper -e ' > @old = ( "10.5 AA", "9 AC", "2 BB"); > @new = do {no warnings q/numeric/; sort {$b <=> $a} @old}; > print Dumper \@new;' $VAR1 = [ '10.5 AA', '9 AC', '2 BB' ]; $

(Added) If you're in pre-5.6 perl, or you just want to do it this way, this works:

$ perl -w -MData::Dumper -e ' > @old = ( "10.5 AA", "9 AC", "2 BB"); > @new = do {local $^W = 0; sort {$b <=> $a} @old}; > print Dumper \@new;' $VAR1 = [ '10.5 AA', '9 AC', '2 BB' ]; $
That knocks out all warnings in the scope.

After Compline,
Zaxo