#!/usr/bin/perl use 5.016; use warnings; #1061986 my @logfile = ("~|TOTAL 24.1% 0.4%", "~|not a total 11%", "~|TOTAL 21.0% 0.7%", "FOOBAR", "~|TOTAL 13.7% 10.2%", "~|TOTAL last5 6", ); my @FIGURE; for my $logentry(@logfile) { if ($logentry =~ /~\|(TOTAL.*)/ ) { push @FIGURE, $1; } else { say "\t \$logentry, $logentry, does not match pattern"; } } for (@FIGURE) { say $_; } =head execution: C:\>1061986.pl $logentry, ~|not a total 11%, does not match pattern $logentry, FOOBAR, does not match pattern TOTAL 24.1% 0.4% TOTAL 21.0% 0.7% TOTAL 13.7% 10.2% TOTAL last5 6 =cut