
mhx
Enthusiast
/ Moderator
Mar 10, 2002, 10:47 PM
Post #2 of 3
(590 views)
|
|
Re: [jumpding] "my $check_str = shift;" what means 'shift'
[In reply to]
|
Can't Post
|
|
Cool post. Why use the message body if there's a subject line? Depends on where you call it. If not used within a subroutine or format, it is equivalent to:
my $check_str = shift @ARGV; So it shifts the first element off the array @ARGV and stores it in $check_str. If it's for example encapsulated in a subroutine, it is equivalent to:
my $check_str = shift @_; Here it shifts the first element off the @_ array, which is implicitly used to pass arguments to a subroutine. See also the [url=http://www.perldoc.com/perl5.6.1/pod/func/shift.html]shift manpage. Hope this helps. -- mhx
At last with an effort he spoke, and wondered to hear his own words, as if some other will was using his small voice. "I will take the Ring," he said, "though I do not know the way."-- Frodo
|