Oh well!
its a quite intersting using /g
I am sure all the beginners will love these neat way of coding.:-)

Thanks

Rajeev Rumale

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Rajeev Rumale
MyAngel.Net Pte Ltd.,                                            Phone  :
(65)8831530 (office)
#04-01, 180 B, The Bencoolen,                               Email  :
[EMAIL PROTECTED]
Bencoolen Street, Singapore - 189648                     ICQ    : 121001541
Website : www.myangel.net
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


----- Original Message -----
From: "Jeff 'japhy' Pinyan" <[EMAIL PROTECTED]>
To: "Sally" <[EMAIL PROTECTED]>
Cc: "perl" <[EMAIL PROTECTED]>
Sent: Monday, June 25, 2001 7:33 PM
Subject: Re: /g


> On Jun 25, Sally said:
>
> >when evaluating strings what exactly does /g do at the end of a lot of
> >evaluation expressions eg:
> >
> >$string =~ /(.)/g
>
> The /g modifier is for regexes only (not strings in general).  It is
> documented in 'perlre' and probably 'perlop' as well.
>
> It tells Perl that the regex is to match, and then REMEMBER WHERE THE
> MATCH ENDED, so that it can start there the next time /.../g is used.
>
> The most common uses of it are:
>
>   # all at once...
>   @all_matches = $string =~ /(pattern)/g;
>
> and
>
>   # one at a time
>   while ($string =~ /(pattern)/g) {
>     # ...
>   }
>
> --
> Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
> I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
> Are you a Monk?  http://www.perlmonks.com/     http://forums.perlguru.com/
> Perl Programmer at RiskMetrics Group, Inc.     http://www.riskmetrics.com/
> Acacia Fraternity, Rensselaer Chapter.         Brother #734
> **      Manning Publications, Co, is publishing my Perl Regex book      **
>
>


Reply via email to