use strict; use warnings; $_ = 'Page 1 of 5'; if(Page\ \;1\ \;of\ \;(/d+)) { print "Number of Pages = ".$1; } __OUTPUT__ Backslash found where operator expected at test.pl line 9, near "Page\" Backslash found where operator expected at test.pl line 9, near " \" (Missing operator before \?) Backslash found where operator expected at test.pl line 9, near "1\" (Missing operator before \?) Backslash found where operator expected at test.pl line 9, near " \" (Missing operator before \?) Backslash found where operator expected at test.pl line 9, near "of\" Backslash found where operator expected at test.pl line 9, near " \" (Missing operator before \?) syntax error at test.pl line 9, near "Page\" Search pattern not terminated at test.pl line 9. #### 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. #### use strict; use warnings; $_ = 'Page 1 of 5'; if(/Page\ \;1\ \;of\ \;(\d+)/) { print "Number of Pages = ".$1; } __OUTPUT__ Number of Pages = 5 #### $string =~ m/regexp goes here/