Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
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 having an uproarious good time at the Monastery: (10)
As of 2014-10-22 10:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (114 votes), past polls