$data_file="reff.data"; open(DAT, $data_file) || die("Could not open file!"); @raw_data=; @results = grep( /^$line[3]/, @raw_data); foreach( @results ) { $record = $_; # strip the beginning key $record =~ s/^\d+//; print "$record"; } close(I); #### $data_file="reff.data"; open(DAT, $data_file) || die("Could not open file!"); @raw_data=; @results = grep( /^$record/, @raw_data); foreach( @results ) { $record2 = $_; # strip the beginning key $record2 =~ s/^\d+//; print "$record2"; } close(I);