/($what){3}/ #### #!/usr/bin/perl -w use strict; my $what = 'fred|barney'; if($what =~ /($what){3}/){ print "$&"; } else{ print "no match\n"; }