in reply to Adding Unique Elements to Array

If i'm reading his request right, here is a way to do that without hashes. I wouldn't recommend this on a large array tho.
push(@array,$foo) unless (grep /$foo/,@array);

Replies are listed 'Best First'.
Re^2: Adding Unique Elements to Array
by ihb (Deacon) on Mar 01, 2005 at 02:52 UTC

    /$foo/ isn't equivalent to $_ eq $foo. Personally I use $_ eq $foo quite often, as I see no benefit in using /^\Q$foo\E\z/.

    You might want to look at first from List::Util.

    ihb

    See perltoc if you don't know which perldoc to read!