open(local *INFILE, '<', $filename) or die("Unable to open the input file: $!\n"); my @filtered = grep { !/[#*]/ } ; print @filtered;