in reply to Regex perplexity
my (%first, %last); while (<DATA>) { next unless /^(Query|Sbjct):\s+(\d+)\s+(?:.*)\s(\d+)\s*$/; $last{$1}= $3; next if exists $first{$1}; $first{$1}=$2; } print<<RESULT; $first{'Query'} $first{'Sbjct'} $last{'Query'} $last{'Sbjct'} RESULT
|
|---|