grep

Evaluates an expression in a Boolean context of each element of an array, temporarily setting $_.

#
# remove comment lines
#
@code_lines = grep !/^#/, @all_lines;

#
# find matching list elements
#
my $node = "hastodt"; 
my @arr = grep /^$node$/i , ('hastodt', 'haso113tb'); 
print " matches: @arr \n";