in reply to Re: Simple prog isnt cooperating
in thread Simple prog isnt cooperating
Yet Another Boring Meeting (where when I'm not needed, I hack Perl). Here's the capture you need. Note that it was quick and dirty, so I have not inserted any checking at all (which should be promoted; always check the value of a capture):
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"; }
Output:
spek@scelia ~/scratch $ perl format.pl Matched|1000Wilma>0 The name that matched was Wilma
|
---|