in reply to Regular expression

Well your action is all in the RE, so you don't have to do anything in your loop. But you need something there else you wouldn't have a loop.

1 just happens to be a convenient useless thing you can calculate in the body of the loop. Put anything useless there and it will work. But 1 is kind of traditional.

Replies are listed 'Best First'.
Re: Re (tilly) 1: Regular expression
by nysus (Parson) on Jun 07, 2001 at 20:41 UTC
    So the '1' is taking the place of '{}'? It looks like you are right because I try
    while (s/(\d)(\d\d\d)(?!\d)/$1,$2/){}
    and that works.

    So this line is similar to the form 'do x while (this is true)' where the 'do x' in this case is just '1', which does nothing. I think I see, now. Thanks!

    $PM = "Perl Monk's";
    $MCF = "Most Clueless Friar";
    $nysus = $PM . $MCF;

      Exactly!