Thread: HI explain me about shift @_
Results 1 to 2 of 2
Related
-
Problem viewing shift reports Forum: PHP Forum
Replies: 0 -
explain Forum: CGI Perl Forum
Replies: 1 -
Can someone please explain how to add this. Forum: CGI Perl Forum
Replies: 3
-
10-16-2006, 11:32 PM #1
HI explain me about shift @_
hi all,
plz explain me , i am new to this..& perl.
plz tell me about the bellow syntax & in this shift @_
what rpresent and from where it will get his array values..
my $self = shift @_;
my $projdir = shift @_;
thanks®ards
chowdary.
-
10-21-2006, 10:00 PM #2
Re: HI explain me about shift @_
the @_ is a special variable that is an array of all variables passed to the function/sub...
and shift simply shaves the first element off the array and returns it at the same time...
in other words if i had:
Code:dosomething('foo', 'bar'); sub dosomething(){ #@_ = array('foo', 'bar') my $firstarrayelement = shift @_; #now $firstelement = 'foo' #now @_ = array('bar') my $secondarrayelement = shift @_; #now $secondarrayelement = 'bar' #now @_ = array(); <-- empty array }
Last edited by ALL; 10-21-2006 at 10:08 PM.
Cloudjiffy- PaaS for Developers
10-05-2020, 12:30 AM in Web Hosting Forum