if ($tally[$i]) { printf {$out} "%-20s %30d \n", $regex, $tally[$i] // 0 ; } #### use 5.032; use autodie; use List::Util qw( max ); use File::Temp qw( tempfile ); my $xml = < 0); say "Your output is available at '$path'"; for my $i (0 .. $#regexes) { my $regex = $regexes[$i]; $regex =~ s/^\(\?\^://; $regex =~ s/\)$//; if ($tally[$i]) { printf {$out} "%-${max_length}s %3d\n", $regex, $tally[$i] // 0 ; } }