in reply to How do i interpolate a variable in a regular expression?
Single quotes don't interpolate. Double quotes do. For example, my $not_interpolated = '$this'; won't interpolate, but my $interpolated = "$this"; will.
But you may find it helpful to use qr// (as discussed in perlop). ...used as follows:
my %config = ( URI => { regex => qr/^$method\ssip:/, sub => \&request_line, }, );
Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How do i interpolate a variable in a regular expression?
by sanjay nayak (Sexton) on Sep 27, 2006 at 07:04 UTC |