Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: $a and strict

by Masem (Monsignor)
on Jul 18, 2001 at 18:00 UTC ( [id://97655]=note: print w/replies, xml ) Need Help??


in reply to $a and strict

$a and $b are special in that they are automagically defined in the main:: scope due to their use in the sort function. In other words, with regards to strictness, they're considered in the same class as @_, $_, etc.


Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain

Replies are listed 'Best First'.
Re (tilly) 2: $a and strict
by tilly (Archbishop) on Jul 18, 2001 at 18:13 UTC
    Not true.

    Unlike *_, *ENV, etc, $a and $b are in the current package. They are just, like @INC, only exempt from strict.

    Beware! Should you wish to write a sort subroutine that will be called from another package, you must go out of your way to use $a and $b from *their* package, and not your own. (Similarly if they try to pass a sort subroutine into your function, it won't work as expected.)

    UPDATE
    Thanks tye for spotting my obvious thinko.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-03-29 11:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found