use strict; use warnings; $_ = 'Page 1 of 5'; if(/Page\ \;1\ \;of\ \;(/d+)/) { print "Number of Pages = ".$1; } __OUTPUT__ Unmatched ( in regex; marked by <-- HERE in m/Page 1 of ( <-- HER E / at test.pl line 9.