# open file1, fil2 ; open F1 , "$file1" or die "Cant open : $! \n" ; open F2 , "$file2" or die "Cant open : $! \n" ; # Create the hash key with each line of the file2 while ( ) { chomp; $file{$_}=''; } # Print the line , if key does not exist in the hash ; while ( ) { chomp ; print $_ , "\n" unless(exists ( $file{$_} ) ) ; }