Catfish, you still have a typo: you dropped the closing parenthesis for the if() block.
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"; }
This code results in:
Matched|0Wilma0| The name that matched was Wilma
Note the strange "0" before and after "Wilma". I am in Windows, so I don't get a $< UID or a $> EUID. As I pointed out, those varibles make no sense in the context of trying to print matched output. When I asked what you "what were you trying to do with those", I was trying to get clarification of what you wanted your output to look like. Were you trying to have angle brackets literally used in your output? like:
That would be accomplished with print "Matched|<$&>|\n";Matched|<Wilma>| The name that matched was Wilma
Or were you trying to have literal dollar signs and literal angle brackets? like:
That would be accomplished with print "Matched|\$<$&\$>|\n";Matched|$<Wilma>$| The name that matched was Wilma
Or did you just really want Wilma to be printed between the vertical bars? like:
That would be accomplished with print "Matched|$&|\n";Matched|Wilma| The name that matched was Wilma
Or did you really want the linux user-id number ($<) and effective user-id number ($>) to surround Wilma? like:
(where ### are actual numbers, not the number-signs I have shown): That would be accomplished with print "Matched|$<$&$>|\n";Matched|###Wilma###| The name that matched was Wilma
In reply to Re^4: Simple prog isnt cooperating
by pryrt
in thread Simple prog isnt cooperating
by catfish1116
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |