#!/usr/local/bin/perl use strict; use warnings; my %hash; @hash{qw(one three)} = undef; while(my $var1 = ){ chomp $var1; if (exists $hash{$var1}) { print "line is $.\n"; } } __DATA__ one two three four