Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Re: Scoping issue when sorting with subroutines

by mdillon (Priest)
on Apr 12, 2002 at 17:50 UTC ( [id://158636]=note: print w/replies, xml ) Need Help??


in reply to Re: Scoping issue when sorting with subroutines
in thread Scoping issue when sorting with subroutines

Use something like this to create $by_sort_method:
sub create_sorter { my $contents = shift; return sub { # sort however you want here $contents{$a}{FOO} cmp $contents{$b}{FOO} }; } my $by_sort_method = create_sorter \%contents; foreach my $id (sort $by_sort_method keys %contents) { ... }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://158636]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-25 04:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found