in reply to searching an array

You want grep

die "bla bla\n" unless grep { $_ eq $name } @array

Or if you want to avoid the overhead of looking at the whole array look at first() in List::Util.


s/if/unless/ - thanks frodo72

Replies are listed 'Best First'.
Re^2: searching an array
by phaylon (Curate) on Jan 03, 2006 at 15:17 UTC
    IIRC 'first' currently has a memleak issue.

    Ordinary morality is for ordinary people. -- Aleister Crowley
      The mem leaks are fixed in v1.18 of Scalar-List-Utils. The developers just haven't resolved the tickets yet.

      Remember: There's always one more bug.
        Good to know, I just remembered these issues a few weeks or months ago were talked about in #catalyst.

        Ordinary morality is for ordinary people. -- Aleister Crowley