[sf-perl] regular expression ?

yary not.com at gmail.com
Mon Sep 26 12:44:05 PDT 2011


On Mon, Sep 26, 2011 at 3:41 PM, Francisco Obispo <fobispo at isc.org> wrote:

> And if the process is running continuously and matching several of these,
> you might want to:
>
> my $patterm= qr/Thank you for your order:\s*(\d+)/;
>
> if ($text =~ m/$patterm/){
>        my $order_num=$1;
>        # do stuff with $order_num
>
> }
>

I don't think that improves performance or readability- the reg exp would be
compiled once at load time either way.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/sanfrancisco-pm/attachments/20110926/da7a5dd4/attachment.html>


More information about the SanFrancisco-pm mailing list