On Sat, Mar 8, 2008 at 9:59 AM, Dr.Ruud <[EMAIL PROTECTED]> wrote:
snip
>  > 2. Can arbitrary regular expressions, including /PATTERN/REPLACEMENT/
>  > versions
>  > for substitutions, be used as subroutine arguments, and if so, how?
>
>  Store the parts in variables.
snip

Specifically, use the qr// operator to create precompiled regexes that
can be stored in a scalar:

my $regex = qr/^.*?([0-9,a-f]{8}):.*$/;

$string =~ s/$regex/$1/;

-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to