Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Re: Less-than-helpful warnings

by ysth (Canon)
on Dec 11, 2003 at 03:33 UTC ( #313957=note: print w/ replies, xml ) Need Help??


in reply to Re: Less-than-helpful warnings
in thread Less-than-helpful warnings

Certainly not if $a and $b are lexical, which in this case they are. I'm not even seeing any problem if they are global. Did perl have a problem at some point where the previous values didn't get restored after the sort?

Update: Sorry, I misunderstood that you were warning against using a sort BLOCK in the lexical scope of $a or $b. If you try, perl will die with an error "Can't use "my $[ab]" in sort comparison".


Comment on Re: Re: Less-than-helpful warnings
Replies are listed 'Best First'.
Re: Re: Re: Less-than-helpful warnings
by jZed (Prior) on Dec 11, 2003 at 03:53 UTC
    To quote from perldoc -f sort: "If you're using strict, you must not declare $a and $b as lexicals. They are package globals."

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (13)
As of 2015-07-28 11:18 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 (254 votes), past polls