|We don't bite newbies here... much|
A better non-existant string...by lzcd (Pilgrim)
|on Jan 23, 2001 at 03:15 UTC||Need Help??|
Just a small meditation that wondered past my frontal lobes recently:
In my own code, when I need to see if a string is empty, I go for something along the lines of:
As opposed to the more common variation of:
My reasoning, up this point, has been that it's less work for the perl engine to compare against a(n almost) literal of '' then have to go through the parse cycle and then compare for a "".
But... recently my brain has been probing the possibility that my assumption is false.
Does perl have a precompiled shortcut for dealing with ""?
Does perl have some magical process where "" is evaluated at the same speed (or faster?) than its '' brethren?
I know in my heart that the difference between the two alternatives is probably no more than a few cycles and I'll probably squander what savings are made through that rather nasty regex further on in the code... but it's been bugging the ol' hamsters wheel for a while now.
Thank you for your microwave popcorn time.