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?

Martin Barth wrote:
> On Fri, 11 May 2007 17:50:41 -0400
> Steve Finkelstein <[EMAIL PROTECTED]> wrote:
> 
>> echo 500 | perl -ple 's|(\d)|length(9 x $1)|eg;'
> 
> no you're wrong:
> s///g <- matches 5 first. length(9x5) == 5, thats true
> 
> but now next digit! 0 -> length ( 9 x 0 )  == length("") == 0
> same again....
> 
> 

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


Reply via email to