On Tue, Mar 11, 2014 at 11:58 PM, Alex Chiang <pigfly...@gmail.com> wrote:
> sub is_in_string { > 38 # @s: string array, $c: character > 39 # passing array into sub > 40 my @s = @_[0]; my $c = $_[1]; <snip...> > 44 my @ar = qw(t d s); > 45 my $c = "d"; > 46 my $res = &is_in_string( @ar, $c); This is a good example of how Perl flattens a parameter list. The "&is_in_string(@ar, $c)" turns into "&is_in_string('t', 'd', 's', 'd');". @_[0] only grabs the first parameter 't'. $_[1] grabs the second parameter - the 'd' from @ar. -- Robert Wohlfarth