XP is just a number | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
And in today's "making Perl work a lot harder than you need to do", let's nominate the following entry:
So, we've asked Perl to construct an array, take a reference to it, then dereference that reference to pick out one of the items, then discard the reference, which then garbage-collects the array. All when we could have written that this way: saving two characters of typing, and all that mess of creating the new array and reference and garbage collecting. We're simply constructing a list, then picking out an element of that list with a literal slice (a construct I suggested for Perl 3, by the way {grin}). To optimize this further, I'd go with a qw for that first list: And in recent versions of Perl, you can even drop that outer set of parens:
I saw bracket-arrow-bracket as a "cute syntax" once. I'm trying to stomp it out, because there's an equivalent construct (as I showed) that is a lot less work for Perl. Please don't propogate "cute syntax" that is more expensive. -- Randal L. Schwartz, Perl hacker
In reply to •Re^2: Writing a simple RSS feed 'grabber' with XML::Parser.
by merlyn
|
|