List checking

[email protected] (Ian Fitzgerald) Mon, 25 Sep 2000 22:12:07 +1100
Newsgroups perl.riscos
Message-ID <c2588934a%[email protected]>
Is there a more elegant means of checking an array for the presence
of a variable before adding it? - grep so far does not work for me.

I currently use

		$count = 0;
		foreach $g (@gs) {
			if ($g eq @parsed[2]) {
			$count++;
			last;
			}
		}
		if ($count == 0) {
			push @gs, @parsed[2];
		}

which seems unwieldy, and BASIC-like.


-- 
Ian Fitzgerald - Melbourne Australia - Acorn RiscPC SA233