Gerard Robin wrote:
> Hello,

Hello,

> in a script I can write:
> 
> if (
> ....
> $subject =~ /phar/i or
> $subject =~ /phfar/i or
> $subject =~ /phhar/i or
> $subject =~ /phya/i or
> $subject =~ /photo/i
> ....
> 
> ){..}
> 
> "or"
> 
> if (
> ....
> $subject =~ /ph(ar|far|har|ya|oto)/i
> ....
> ){...}
> 
> "or" 
> 
> if (
> ....
> $subject =~ qr(ph(ar|far|har|ya|oto))i
> ....
> ){...}
> 
> I wonder which one of these forms is faster ?

The first one should be faster.  Of course you could use the Benchmark module
to find out for sure.


> About qr : 
> 
> if  I do :
> 
> $match = qr(ph(ar|far|har|ya|oto));
> 
> print ref $match, $/;
> 
> I get the output:
> 
> Regexp
> 
> What is $match exactly ? 

It is a compiled regular expression.



John
-- 
use Perl;
program
fulfillment

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


Reply via email to