#!/nairvig/bin/perl use strict; use warnings; use Data::Dumper; my $file1 = 'file4'; my $file2 = 'file3'; open (my ($fh2),'<',$file1) or die $!; while (my ($row) = <$fh2>) { chomp $row; my (@fields) = split(/\|/, $row); next if $row =~ /^\s*$/; print "<$fields[0]>\n "; #print $row if exists $hash{$fields[0]}; } close $fh2;