News for hackers. Stuff that matters.
Re:Worst Bug Ever by jey on Monday January 21, 2013 @04:13PM (#5093788)

    using $a or $b for a throw-away script, but Perl uses these internally for sorting
Everything I learn about Perl just makes me hate it more. But a lot of people seem to love it -- it must have some redeeming qualities, right?
Re:Worst Bug Ever by draegtun on Tuesday January 22, 2013 @06:27AM (#5096580)
There is nothing to be afraid of here, sort just makes use of localised $a & $b package variable names as references to the sort block:

    our $a = 100;   # using $a package variable

    # then later do a sort on @list
    my @sorted = sort { $a cmp $b } @list;

    # @sorted worked correctly, $a = 100 had no effect on it
    # and $a is still 100
And if we change our to my (so lexical variable) then script will fail to compile giving the fatal error: Can't use "my $a" in sort comparison at...

For more information on sort see: http://perldoc.perl.org/functions/sort.html

PS. The OP problem may have been due to issue/bug in older version of Perl. Also using use strict; use warnings do help highlight issues with code.

Re:Worst Bug Ever by bch on Saturday January 26, 2013 @03:06PM (#5121569)
Indeed.

First 3 lines of all perl code for me are:

  #!/usr/bin/env perl
  use strict;
  use warnings;
Re:Worst Bug Ever by kamaal on Tuesday January 22, 2013 @12:08AM (#5095641)
Everything I learn about the world makes me hate it more. But a lot of people seem to love it --it must have some redeeming qualities, right?

Answer: Yes, depends on where in the world you live.