in reply to matching constants within a regular expression?
Whether this is any less ugly you'll have to make your own mind up about.
use constant FRED=>'fred'; my @s = qw[ the=the quick=quick brown=brown fred=fred1 jumped=jumped over=over the=the lazy=lazy fred=fred2 ]; $_ =~ ( FRED . '=(.*)$' ) and print "Found $1" for @s; Found fred1 Found fred2
|
---|