c:\@Work\Perl\monks>perl -wMstrict -le "use Test::More 'no_plan'; use Test::NoWarnings; ;; use constant W => 0.5; ;; my @records = ( 'U_TOP_LOGIC/ipre_reg_0/Q,0,0,1,1,0,0,1,1,0,0', 'U_TOP_LOGIC/ipre_reg_6/Q,1,1,0,0,1,1,0,0,1,1', 'U_TOP_LOGIC/pre_reck_1/Q,1,1,0,1,1,0,0,1,1,0', 'U_TOP_LOGIC/pre_reg_10/Q,0,1,0,1,1,0,0,1,1,1', 'U_TOP_LOGIC/pre_reg_11/Q,0,0,1,0,1,0,0,1,0,1', ); ;; my $rx_transition = qr{ (?<= 1) 0 | (?<= 0) 1 }xms; ;; my @pat = (0); for my $record (@records) { my (undef, $trans) = split m{ \d/Q, }xms, $record, 2; $trans =~ tr/01//cd; $pat[ $-[0] ]++ while $trans =~ m{ $rx_transition }xmsg; } $_ *= W for @pat; ;; is_deeply \@pat, [ 0, 0.5, 2.5, 1.5, 1.5, 1.5, 1, 1.5, 1.5, 1, ], 'weighted'; ;; done_testing; " ok 1 - weighted 1..1 ok 2 - no warnings 1..2