Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^2: Calculate prime factors for a given numer in a perl one-liner

by Utilitarian (Vicar)
on Dec 16, 2010 at 09:00 UTC ( [id://877453]=note: print w/replies, xml ) Need Help??


in reply to Re: Calculate prime factors for a given number in a perl one-liner
in thread Calculate prime factors for a given numer in a perl one-liner

I hadn't previously encountered this piece of (lateral|perversity of) thought and so I played about with it a bit. I noticed that once the regex encounters a match greater than 2^16 in length it stops matching. (eg run the command with the argument 131072 (2^17) ).

Is this a limit of the non-greedy match in regex that I am encountering?

print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."
  • Comment on Re^2: Calculate prime factors for a given numer in a perl one-liner
  • Download Code

Replies are listed 'Best First'.
Re^3: Calculate prime factors for a given numer in a perl one-liner
by moritz (Cardinal) on Dec 16, 2010 at 09:22 UTC

    I didn't investigate it thoroughly, but I think it's not the non-greediness. Rather the + in the regex is compiled to {1,32767}, which is a general limit of the 16 bit heritage of the regex engine.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (6)
As of 2024-04-24 08:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found