in reply to Regex Question in Perl

The "?" in ".*?" makes ".*" matches as few characters as possible. Get rid of it.

Furthermore, the "g" in if (/.../g) makes no sense conceptually (check if there's a match, then check again to be sure?) or in practice (it has weird side effects). Get rid of it.

I dislike using global variables for no reason, so I'd write it

my $page2 = "Account number 12345678"; if ( my ($acct) = $page2 =~ /Account number (.*)/ ) { print "acct = $acct\n"; }