my %hash = (); my $dummy = map( $hash{ $_ } = 1, @array ); my $checkthis = 'at'; ... if ( defined( $hash{ $checkthis )) { ... } #### my $found = ( $_ eq $checkthis ) && last for ( @array ); #### use strict; use warnings; Package Company; sub new { my $self = shift; my $regno = shift or die "Must supply reg. no."; $self = {}; $self -> { REGNO } = $regno; return bless $self; } sub parent { my $self = shift; my $parent; unless ( $parent = shift() ) { if (defined $self -> { PARENT } ) { return $self -> { PARENT }; else { return undef(); } } if ( defined $parent -> { REGNO } ) { $self -> { PARENT } = $parent; } else { die "Invalid parent reference"; }