if (m|()(.*?)()|) { print "1 - '$1'\n2 - '$2'\n3 - '$3'\n"; } else { print "Hmm, no match. Is this what happened?\n"; }