#!/usr/bin/perl use warnings; use strict; my ($record,%hash); while ( ($record, %hash)=get_record() and $record ne '' ) { next unless $hash{f} ne ''; print "$record\n"; print "Extra parsed info:\n"; foreach my $key (keys %hash) { print " $key \tvalue=$hash{$key}\n"; } print "\n"; } sub get_record { my $line; my $record=''; while (defined($line=) and $line !~ /^\s*$/) { $record .= $line } my %hash = $record =~ /(\w+)=(\w+)/g; ($hash{f}) = $record =~ /f (.*)/; $hash{f} //=""; return ($record, %hash); } =Prints: b=54 y=0x23 arg=0x78 def=0x2 val=0x65b f chk.fin.reg.m_cwr 0x213 Extra parsed info: def value=0x2 val value=0x65b f value=chk.fin.reg.m_cwr 0x213 b value=54 y value=0x23 arg value=0x78 b=40 y=0x90 arg=0x34 def=0x5 val=0x2197 f ref.grf.pin.clk_trg 0x0021 Extra parsed info: arg value=0x34 y value=0x90 f value=ref.grf.pin.clk_trg 0x0021 b value=40 def value=0x5 val value=0x2197 =cut __DATA__ b=23 y=0x11 arg=0x70 def=0x1 val=0x234 checking system b=71 y=0x35 arg=0x87 def=0x3 val=0x76d h=reg.k2.io.chk 0x2001 b=54 y=0x23 arg=0x78 def=0x2 val=0x65b f chk.fin.reg.m_cwr 0x213 b=54 y=0x23 arg=0x78 def=0x2 val=0x65b checking system b=40 y=0x90 arg=0x34 def=0x5 val=0x2197 f ref.grf.pin.clk_trg 0x0021