Dear list,
i'am just wondering about the behaviour of shift and the defaultvariable @_ .
I use the following code::
while (<RULEFILE>) { # each line of RULEFILE is stored in $_
chomp; # delete \n from $_
split /;/; # split the fields of $_ seperated
by ; into @_
print "Array before shift: @_\n"; # prints @_
my $test = shift @_; # $test gets the first
item from @_
print "Array after shift: @_\n"; # print @_ without the
first item
}
everything works fine.
Now i change the line "my $test = shift @_" into "my $test = shift". This
should work because shift should use @_ by default.
But in this case $test is empty an the second print command prints still the
whole @_.
I really don't know why this should not work?
I would be happy about any help.
Greetings
Mathias
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>