use warnings; use strict; $/ = "\n\n"; while () { my %data; for my $line (split /\n/) { my ($k, $v) = split /\s*:\s*/, $line; $data{$k} = $v; } print "$data{'First Name'} $data{'Last Name'}\n" if $data{Location} eq 'Central USA'; } __DATA__ First Name: John Last Name: Doe Occupation: Network Administrator Location: West Coast First Name: Jane Last Name: Doe Occupation: Human Resources Location: East Coast First Name: James Last Name: Doe Occupation: Technical Support Engineer Location: Central USA