|XP is just a number|
Re: Answer: How do I find today's date?by Sol-Invictus (Scribe)
|on Feb 06, 2004 at 08:07 UTC||Need Help??|
This is great example of how not to get people to help you. No info about what you're doing with this, and no script.
The line of code you did send works for me:
Without the rest of the script, it's impossible to tell where it's breaking exactly, though my guess is the variables don't contain what you think.
But I'd like to take the opportunity to suggest a couple of optimisations:
Using a '.' to join strings in a print() statement is expensive - you are doing 2 operations when 1 is enough. print() expects a comma separated list, so:
looks the same on output but behind the scenes is less expensive to use, just how much less expensive?
running the above code I got this
that's means print()ing with commas is over 300% faster.
Using quotes (") on a variable with a print() statement is likewise usually a bad idea because perl has to convert the same information to a string twice, once because of the quotes, the second time to print it.
Benchmarking this is less dramatic than the concatination Vs commas test - it shows an improvement of 6%. However if you're looking to speed up an script these are the kinds of things you should check for first.
You spend twenty years learning the spell that makes nude virgins appear in your bedroom, and then you're so poisoned by quicksilver fumes and half-blind from reading old grimoires that you can't remember what happens next.