Mathias Pasquay wrote: > Dear list, Hello,
> 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 @_ You should have gotten the warning "Use of implicit split to @_ is deprecated" which means that you shouldn't do that. You should enable warnings. my @array = split /;/; > 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. No, in this case it uses @ARGV by default. perldoc -f shift > 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. John -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>