in reply to regex match after pattern

Another approach to a regex solution, assuming Choroba's explanation of when a regex might be the appropriate tool... and multiple sources, simulated by the array below:

#!/usr/bin/perl use 5.018; use strict; use warnings; my @message = ('<form method="post" action="login.lp" name="authform" +id="authform"> <input type="hidden" name="rn" value="-1383135969">', '<form method="post" action="login.lp" name="authform" i +d="authform"> <input type="hidden" name="rn" value="-2383135969">', '<form method="post" action="login.lp" name="authform" i +d="authform"> <input type="hidden" name="rn" value="-3383135969">'); for my $msg (@message) { $msg =~ /^action.*?\"rn\"\s+value\=+"([^"]+)"/g; # say " DEBUG: At Ln 15, msg: $msg"; if ( $msg =~ /\"rn\"\s+value\=+"([^"]+)"/ ) { my $rn= $1; say "At Ln 19, \$rn: $rn\n"; } } =head C:\>1119824.pl At Ln 19, $rn: -1383135969 At Ln 19, $rn: -2383135969 At Ln 19, $rn: -3383135969 =cut