|We don't bite newbies here... much|
Reportingby krazken (Scribe)
|on Apr 03, 2003 at 16:53 UTC||Need Help??|
As I make my daily treks to the gates to learn/help where I can, I have noticed something...The majority of perl users/developers use perl for about everything except what the language letters stand for Practical Extraction and Reporting Language. We have entire websites run by perl, database applications, automation sequences, obfuscation , data munging, whatever.. I say all of that to bring this thought...Because Perl is so flexible, and can do just about anything we need it to, and a lot of us are most comfortable when coding in perl, does it necessarily make perl the end-all-be-all language. What forces us to NOT use perl? Another note I have is this...many of us have 'standard' stuff that we do everyday in perl, or a standard way of reading in files, or doing this or doing that, and some of it is probably a LOT more efficient than the way that I currently do stuff...and it is stuff that you can't necessarily put in a 'module' to share with the world, its just part of your coding nature.. So as to not open flame wars, or pandora's box, or anyother bad nasty thing...I thought maybe we could share with each other our 'best practices'..Obviously this couldn't be done at the language level, otherwise it would get really hairy, and wouldn't be of much use... So how about data munging...
take me for example...when reading in a fixed width file, I ALWAYS use pack and unpack instead of substr...why? because substr is SLOW, and I can parse the entire record at once instead of one field at a time.
When tie'ing hashes to a file with DB_File, I always use $DB_BTREE instead of $DB_HASH, because the search time to hit the hash seems to be faster when dealing with multi-million record files. I could be totally wrong and not know it too..
is for faster than foreach? dunno, never benchmarked it...anyone know?
As you can see I am looking for simple stuff here...nothing funky that is hard to interpret, just perl basics that we take forgranted sometimes in thinking that everyone knows about them.
Thanks in advance Robert