Beefy Boxes and Bandwidth Generously Provided by pair Networks chromatic writing perl on a camel
P is for Practical
 
PerlMonks  

Re: What does the SHIFT bit do in a constructor

by jorg (Friar)
on May 25, 2001 at 13:03 UTC ( [id://83285]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to What does the SHIFT bit do in a constructor

Leaving all this class constructor stuff alone :
if you use shift without an array as argument it will shift from @_ (which is the array of arguments passed to a sub) when called in a sub or from @ARGV (which is the array of arguments passed to the perl program) when called from the main program body.

Thus :

myshift("testme"); sub myshift{ print shift; #same result print shift @_; }


Jorg

"Do or do not, there is no try" -- Yoda

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://83285]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.