From: "Shishir K. Singh" <[EMAIL PROTECTED]>
> >How exactly does on pre-compile the regex? I would be interested in
> >seeing this.
>
> >[Jess]
>
> Three cases:
> a) Hardcode - /(\w{5})(something)(\w{5})/
> b) Intepolate variable in the search variable, value remaining
> constant throughout the program
> $var = something
> /(\w{5})(something)(\w{5})/o
>
> c) If the value is going to change,
> then use eval to build up a whole block
And the fourth:
$compiled_reg_exp = qr/(\w{5})($something)(\w{5})/;
while (<>) {
if ($_ =~ $compiled_reg_exp) {
...
}
}
You can prepare an array of compiled regexps if you need.
See
perldoc perlre
Jenda
=========== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==========
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain
I can't find it.
--- me
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]