Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Re: Unrolling the loop technique

by chipmunk (Parson)
on Jun 19, 2001 at 18:40 UTC ( #89648=note: print w/replies, xml ) Need Help??


in reply to Re: Unrolling the loop technique
in thread Unrolling the loop technique

There may be much more than a little difference. Consider the output from the following program when run under perl5.005:
#!perl -wl use strict; my $good = <<EOT; a quote " with some text after it and then another quote " EOT my $bad = <<EOT; a quote " with some text after it but without another quote EOT my $obvious = qr/"(?:\\.|[^"\\]+)*"/; my $unrolled = qr/"[^"\\]*(?:\\.[^"\\]*)*"/; $| = 1; print "\$good =~ \$unrolled"; print $good =~ $unrolled; print "\$good =~ \$obvious"; print $good =~ $obvious; print "\$bad =~ \$unrolled"; print $bad =~ $unrolled; print "\$bad =~ \$obvious"; print $bad =~ $obvious; print "done";
The problem should become clear by the time it finishes. ;)

Jeffrey Friedl goes into much more detail in Mastering Regular Expressions, which is where I grabbed the regexes I used above.

However, if you run this program under perl5.6, you won't have as much time to figure out the issue, because there are improvements to the regex engine in that version which fix the problem!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://89648]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2021-06-22 22:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)












    Results (110 votes). Check out past polls.

    Notices?