if ( /see the \d brown foxes\. they are \w+ fast\./ ) { # do something } #### my ($count, $word); if (($count, $word) = /see the (\d) brown foxes\. they are (\w+) fast\./) { print("There are $count foxes. Let's go hunting!$/"); }