We don't bite newbies here... much | |
PerlMonks |
Array within regexp?by jfrm (Monk) |
on Feb 27, 2012 at 07:36 UTC ( [id://956390]=perlquestion: print w/replies, xml ) | Need Help?? |
jfrm has asked for the wisdom of the Perl Monks concerning the following question: Oh peaceful ones, I have an array @titles = qw/Mr Mrs Ms Miss Dr Sir Lord Lady Rev/; To avoid the darkness of repetition and exult the glory of elegance, I would like to use it in the following regexp instead of retyping all the array elements: $text =~ /^(Mr|Mrs|Ms|Miss|Sir|Lord|Lady|Dr|Rev)\s+(.*)/) Please can anyone empower me with the knowledge?
Back to
Seekers of Perl Wisdom
|
|