#!C:/perl/bin -w use strict; use Data::Dumper::Simple; use vars qw ( $i $j $tmp $test @data @found $found %h ); $i = 1; # tracking counter - in full version does NOT necessarily == $j $j = 0; # track datalines %h = (); while () { push @data,$_ ; } foreach $test(@data) { test1($test); } &hashprint; exit(); ################ subs ############# sub test1 { # first, get rid of previous array conents (needed in full vers) undef(@found); # Categorized Q&A book answer; "@found = ();" is an alternate $j++; print "\n\t ***** STARTING dataline $j ****\n\n"; if ($test =~ /(\{{1}[a-z]{4,5}\s\d\s\d\s[^}]+?\}\s\{[^}]+?\}{2})/gx ) # see NOTE1 { if ( $1 ) { $tmp = "\t\$j" . $j . "\$i". $i . ": " . $1 . "\n"; push @found, $tmp; &hashify; print "TEST1 regex, dataline $j found match(es)\n"; print "\t $1\n"; } else { print "\t TEST1 dataline $j, NO matches.\n"; } } $i++; return($i) } # end sub test1 # (more similar tests here in full version) ############## sub hashify { $h {'datalinej'.$j."_i".$i} {"j".$j."i" .$i} = "@found"; # get all @found's elements into hash ??? $tmp = ''; return(); } # end hashify ########### sub hashprint { print "\n\t\t~~~~~~~~~~~~~~~~ Dumping hash (HoA)\n"; print Dumper (%h); print "\t\t~~~~~~~~~~~~~~~~ ending dump\n"; } # end sub hashprint and end subs __DATA__ DataLine1 {error 1 1 {^E 0-20-9:0-50-9:0-50-9.*$} {^E 0-20-9:0-50-9:0-50-9.*$}} {three 1 1 {^.*35=A.*$|^.*35=5.*$} {^.*35=A.*$|^.*35=5.*$}} {fixv 1 1 ^.*VFIXFxProxy.*Disconnected ^.*VFIXFxProxy.*Disconnected} DataLine2 error 1 1 {^E 0-20-9:0-50-9:0-50-9.*$} {^E 0-20-9:0-50-9:0-50-9.*$} {three 1 1 {^.*35=A.*$|^.*35=5.*$} {^.*35=A.*$|^.*35=5.*$}} {fixv 1 1 ^.*VFIXFxProxy.*Disconnected ^.*VFIXFxProxy.*Disconnected}