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

Re: What does the SHIFT bit do in a constructor

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


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
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2021-09-16 19:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?