Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Less-than-helpful warnings

by jZed (Prior)
on Dec 10, 2003 at 20:02 UTC ( #313841=note: print w/ replies, xml ) Need Help??


in reply to Less-than-helpful warnings

Well, not related to your question, and perhaps also less than helpful, but just in case ... you do know that you can get into trouble if you define $a and $b in a script that uses sort?


Comment on Re: Less-than-helpful warnings
Re: Re: Less-than-helpful warnings
by ysth (Canon) on Dec 11, 2003 at 03:33 UTC
    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".

      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://313841]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2014-09-20 18:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (160 votes), past polls