in reply to Re: boolean IN(); function in perl like
in thread boolean IN(); function in perl like

Thx for the info and code. I can see "my $s =shift;" will take the first parameter passed to sun s_in_a; but I am not clear about @_ in "foreach (@_)", does @_ mean the array you pass in? Is it necessary to pass array by reference then dereferrence it? Thx, I appreciate it.
  • Comment on Re^2: boolean IN(); function in perl like

Replies are listed 'Best First'.
Re^3: boolean IN(); function in perl like
by Tanktalus (Canon) on Jan 14, 2005 at 19:45 UTC

    Call it something like: s_in_a($scalar, @array_to_check) - no array references here.

Re^3: boolean IN(); function in perl like
by renz (Scribe) on Jan 14, 2005 at 21:40 UTC
    You're correct about @_. From the Perl Predefined Variables page: "Within a subroutine, the array @_ contains the parameters passed to that subroutine."

    /renz.