Foggy Bottoms has asked for the wisdom of the Perl Monks concerning the following question:
How does the sub manage to figure out what's the size of @a and @b so that when you use the shift tool you don't end up with @array1 being ("mary","had","a","little","lamb","!","London","Bridge","is"); and @array2 nothing...sub test { my $number = shift; my @array1 = shift; my @array2 = shift; # do your stuff } ........................ my @a = ("mary","had","a","little","lamb","!"); my @b = ("London","Bridge","is"); # call sub test(3,@a,@b);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Parameters, subs and the shift function
by Abigail-II (Bishop) on Aug 19, 2003 at 11:08 UTC | |
by monktim (Friar) on Aug 19, 2003 at 14:42 UTC | |
by Abigail-II (Bishop) on Aug 19, 2003 at 14:55 UTC | |
by monktim (Friar) on Aug 19, 2003 at 15:02 UTC | |
|
Re: Parameters, subs and the shift function
by edan (Curate) on Aug 19, 2003 at 11:15 UTC | |
|
Re: Parameters, subs and the shift function
by larsen (Parson) on Aug 19, 2003 at 11:08 UTC | |
|
Re: Parameters, subs and the shift function
by CombatSquirrel (Hermit) on Aug 19, 2003 at 12:16 UTC | |
|
Re: Parameters, subs and the shift function
by davorg (Chancellor) on Aug 19, 2003 at 14:13 UTC | |
by edan (Curate) on Aug 19, 2003 at 14:22 UTC | |
by Foggy Bottoms (Monk) on Aug 19, 2003 at 14:17 UTC |