#!/usr/bin/perl -w use strict; sub Case1 { print "AtUnderscore: ",(join ",",@_),"\n"; print "shift: ",shift,"\n"; # string is now gone from @_ , which means # that $_[1] should be 5, and $_[2] is undef # This shows to be true (see output Case1) print "AtUnderscore after shift: @_\n"; print "\$_[1]: $_[1]\n"; print "\$_[2]: $_[2]\n"; }; sub Case2 { print "AtUnderscore: ",(join ",",@_),"\n"; # Please explain to me HOW I can shift @_ # here, but still have access to the original # $_[2] (see var $Rubbish)... my $Rubbish=join "",(split //,shift)[$_[1]..$_[2]]; # But HERE I lost the access to $_[2]. # its gone!!! print "Rubbish: $Rubbish\n"; print "1: $_[1]\n"; print "2: $_[2]\n"; }; print "\n\nCase1:\n"; Case1("This_is_a_string",3,5); print "\n\nCase2:\n"; Case2("This_is_a_string",3,5); #### Case1: AtUnderscore: This_is_a_string,3,5 shift: This_is_a_string AtUnderscore after shift: 3 5 $_[1]: 5 Use of uninitialized value in concatenation (.) at ./mysplit line 16. $_[2]: Case2: AtUnderscore: This_is_a_string,3,5 Rubbish: s_i 1: 5 Use of uninitialized value in concatenation (.) at ./mysplit line 34. 2: