Wow !! That perfect!!! Exactly what I want !
Thank you very much John.

Jim


----- Original Message ----- 
From: "John W. Krahn" <[EMAIL PROTECTED]>
To: "Perl Beginners" <beginners@perl.org>
Sent: Wednesday, December 21, 2005 12:30 PM
Subject: Re: Assign regex in var possible ?


> Jimmy wrote:
> > Hi all,
>
> Hello,
>
> > Just start with perl, not so understood what's the range on using regex.
> >
> > Can I do something like :
> >
> > $x = /\.(jpg|jpeg|gif|bmp)$/i;
>
> That is interpreted by perl as:
>
> $x = $_ =~ /\.(jpg|jpeg|gif|bmp)$/i;
>
> So yes you can do that but it looks like you really want to use the qr//
operator:
>
> my $x = qr/\.(jpg|jpeg|gif|bmp)$/i;
>
> > for (@filelist)
> > { push @result, $_ if $_ =~ $x }
>
> You can shorten that by using the match operator:
>
> { push @result, $_ if /$x/ }
>
>
>
> 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>
>
>
>



-- 
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