in reply to Filter output based on values

Have you looked at the value of $tally[$i] ? Maybe it helps to formulate your if condition better if you inspect and print that value.

For your printf question, see printf, which points you to sprintf, but sprintf can only do fixed-width. I often use Text::Table instead.

use Text::Table; my $tb = Text::Table->new( "Regex", "Tally" ); my @rows; for my $regex (@regexes) { my $tally; $tally++ while $xml =~ /$regex/g; $regex =~ s/^\(\?\^://; $regex =~ s/\)$//; push @rows, [$regex, $tally]; } $tb->load( @rows ); print $tb;