#!/usr/bin/perl -w use strict; my $myPattern = "([A-Z])(\\d)"; my $myTestString = "B99"; $myTestString =~ m/$myPattern/; print "The pattern is '$myPattern'.\n"; print "The test string is '$myTestString'.\n"; print "The whole match is '$&', contained in the \$& variable.\n"; print "The first captured group is '$1', contained in '\$1'.\n"; print "The second captured group is '$2', contained in '\$2'\n";