On 5/11/07, Chas Owens <[EMAIL PROTECTED]> wrote:
On 5/11/07, Steve Finkelstein <[EMAIL PROTECTED]> wrote:
> Oh, so it goes through each and every character in the original string
> passed. I thought it takes in the string as one entity and just captures
> the first digit it can.
>
> Does -p make it iterate over each character?

No, the -ple causes it to write the code like this:

$\ = $/;
LOOP:
WHILE (<>) {
    s/|(\d)|length(9 x $1)|eg;
}

The g on the end of the regex causes it to apply the pattern multiple
times.  The e on the end of the regex makes it treat the replacement
like code instead of a string.


Whoops, that should be

$\ = $/;
LOOP:
WHILE (<>) {
  chomp;
  s/|(\d)|length(9 x $1)|eg;
}

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to