use v5.12; use warnings; my $Namelist = 'Wilma Fred Barney Betty Dino'; if ( $Namelist =~ m/(\w+a)/) { print "Matched|$<$&>$|\n"; say "The name that matched was $1 \n"; } else { print "No match: \n"; } #### spek@scelia ~/scratch $ perl format.pl Matched|1000Wilma>0 The name that matched was Wilma