List Info

Thread: qr




qr
country flaguser name
United States
2007-06-01 02:05:12

What is the difference between these two expressions?

$pat=qr/some_regex/;
How is /{$pat}xxx/ and /$xxx/ different?

Thx.

I know Karate, Kung fu and 47 other dangerous words.


---------------------------------
New Yahoo! Mail is the ultimate force in competitive emailing. Find out more at the Yahoo! Mail Championships. Plus: play games and win prizes.

[Non-text portions of this message have been removed]

__._,_.___
.

__,_._,___
Re: qr
country flaguser name
Czech Republic
2007-06-01 07:31:00

From: kapil v < aaaaax2003%40yahoo.com">aaaaax2003yahoo.com>
>; What is the difference between these two expressions?
>
> $pat=qr/some_regex/;
> How is /{$pat}xxx/ and /$xxx/ different?

Try that!

The first one would look for an opening curly brace followed by
whatever the some_regex matches followed by closing curly and 'xxx',
the second would match whatever some_regex matches followed by 'xxx'.

You should keep in mind that $variable and ${variable} means exactly
the same and that {} is only special in a regexp if it contains a
number, number and a comma, comma and a number or two numbers
separated by commas. (In which case if specifies the exact, maximum,
minimum and range of occurences of the item preceding the openning
curly.

Jenda
===== Jenda%40Krynicky.cz">JendaKrynicky.cz === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

__._,_.___
.

__,_._,___
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )