On Tue, 2008-09-02 at 10:51 -0400, Mr. Shawn H. Corey wrote:
> Sorry, it's Tuesday after a long weekend; brain is not fully in gear
> yet. Try:
>
> while( eval "\$text =~ s/$rexp/$replacement/$flags" ){
I tried this. Actually, I tried something slightly different:
print "Enter rexp: ";
my $rexp=<STDIN>;
chomp($rexp);
while(eval "\$text =~ $rexp"){
print length("$`\n");
}
which I assume should be exactly the same.
The problem here is that it prints 0 all the times it matches.
This is due, I believe, to the fact that $` (as well as $digit, $& and
the like) are dynamically bound to the eval block...
I haven't found a way to "unlocal"-ize them... :(
--
Paolo Gianrossi
Softeco Sismat S.p.A. - R&D Division
via De Marini 1, 16149 Genova
Tel: +39 010 6026 332 - Fax: +39 010 6026 350
E-Mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/