regex



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 ?


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 ?

Why I can bless $match ?

tia (I know perldoc perlop ...)


--
Gérard

.



Relevant Pages

  • VBS to replace text
    ... I am trying to find a script that will search an html file and replace one ... TIA ... Prev by Date: ...
    (microsoft.public.scripting.vbscript)
  • Find directories containing two or more specified files
    ... Is this possible from a one liner, or do I need to write a script? ... TIA, ... Richard ... Prev by Date: ...
    (comp.unix.shell)
  • Re: Text Script
    ... >> I need a simple script to add text layer. ... >> TIA. ... > Comic book sketches and artwork: ... Prev by Date: ...
    (alt.graphics.photoshop)
  • Re: Empty the "Deleted Items" folder when quitting?
    ... Is there anyway to get the question back (Do you want to empty your ... Is it a script perhaps? ... TIA ... Prev by Date: ...
    (microsoft.public.mac.office.entourage)
  • Re: AWK problem need help
    ... The script is as follows: ... printf ("PAT:%s\n", $prev) ... The latter would print the field at whatever position "var" contains, and the whole record if var is zero or unset. ... Also, you don't need the " " as the final argument to splitas that's the default, and awk arrays start at 1, not 0 so "lastline" will always be empty. ...
    (comp.unix.shell)