in reply to Passing / evaluating / dieing on one line...

What's wrong with:
(my $label_colnum = &column_exists( \@data, $_[1] || 0 )) != -1 or die +;

Replies are listed 'Best First'.
Re: Re: Passing / evaluating / dieing on one line...
by talexb (Chancellor) on Apr 05, 2002 at 14:25 UTC
    I don't believe that $_[1] is going to tell the routine column_exists to get the second element of @data -- it's going to pass the second element of $_, whatever that may be. It's a different context -- that's why my solution used 1 instead.

    Down in the subroutine, @{$_[0]}[1] will select the second element of the first parameter (as an array reference), which is close to $_[1] but still not the same thing.

    --t. alex

    "Here's the chocolates, and here's the flowers. Now how 'bout it, widder hen, will ya marry me?" --Foghorn Leghorn

    Somehow the desire to use $_[0] within routines (or anywhere, for that matter) has never tempted me. Why not just declare and use a my variable?