Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: my $a outside sort block incompatibility

by poolpi (Hermit)
on Feb 23, 2009 at 15:03 UTC ( #745775=note: print w/ replies, xml ) Need Help??


in reply to my $a outside sort block incompatibility

I thought I'd previously found a way of using "local" to get around this but I can't reconstruct it now.

#!/usr/bin/perl use strict; use warnings; my @arr1 = ( 1, 3, 5, 2, 4, 6 ); my @arr2; local $a = 'whatever'; { @arr2 = sort { $a <=> $b } @arr1; } print join( ' ', @arr2 ), "\n";


hth,
PooLpi

'Ebry haffa hoe hab im tik a bush'. Jamaican proverb


Comment on Re: my $a outside sort block incompatibility
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (12)
As of 2015-07-30 19:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (273 votes), past polls