foreach my $thing ( @things ) { next if $thing eq $known_junk; # exact string comparison; change as needed print "$thing\n"; # whatever's not junk }