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 ]

Ovid (2709)

Ovid
  (email not shown publicly)
http://publius-ovidius.livejournal.com/
AOL IM: ovidperl (Add Buddy, Send Message)

Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.

Journal of Ovid (2709)

Wednesday February 11, 2004
02:58 PM

More 'n more bugs.

[ #17362 ]

Of course this won't work. Silly me.

    my $line_no = 1;
    @expected_data =
        sort {
            $a->[1] <=> $b->[1]
                ||
            Foo::compare($a->[5], $b->[5])
                ||
            $a->[2] <=> $b->[2]
        }
        map { unshift @$_ => $line_no++ }
            @expected_data;

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.
  • I think I see a couple of problems, but I'd need to see the whole code to get it.

    map generates a simple list, but the sort code appears to be working on a list of array reference. It looks like you were trying to build a hash with map. However, the sort code thinks that each element of the list is an array reference. The "keys" of the "hash" may be array refs (which would be super weird), but the "values" certainly are not.

    This is very functional (that is lisp-like) code. Perhaps you might consider tu