in reply to newbie alert: find in array

I would be inclined to use a associative array for this, since it allows you to easily track the number of ocurrences. eg. foreach $possibly_new_element (@all_elements) { $element_count{$possibly_new_element}++; } then to display what you've found foreach(keys %element_count) { print"$_ ocurred $element_count{$_} time(s)\n"; }