@search = ( [ 'ABANDON', 'position', 'origposition', 'waittime'] , [ 'AGENTDUMP', 'event' ] , [ 'AGENTLOGIN', 'channel' ] , [ 'COMPLETECALLER', 'holdtime', 'calltime', 'origposition'] , [ 'COMPLETEAGENT', 'holdtime', 'calltime', 'origposition' ] , [ 'CONFIGRELOAD' , 'event'] , [ 'CONNECT' , 'holdtime' ] , [ 'ENTERQUEUE', 'url', 'callerid' ] , [ 'EXITWITHKEY', 'key', 'position' ] , [ 'EXITWITHTIMEOUT', 'position' ] , [ 'QUEUESTART' , 'event' ] , [ 'SYSCOMPAT' , 'event' ] , [ 'TRANSFER' , 'extension', 'context' ] ) ; $number_of_matches = @search ; $file=File::Tail->new(name=>$filename, maxinterval=>1, adjustafter=>100, reset_tail=>0. ); while (defined($line=$file->read)) { for ($i=0; $i < $number_of_matches; $i++) { if ($line =~ $search[$i][0]) { foreach $new (@search->ref[0]) {print "$ref\n"; } } } }