Grouping perl foreach values
Alex Satrapa
grail at goldweb.com.au
Wed Jul 10 00:24:30 EST 2002
On Tuesday, July 9, 2002, at 08:45 , Richard Cottrill wrote:
> After making some truly horrible Perl code, while figuring out what
> worked
> best for me, I came to the conclusion that structuring the data made
> life a
> LOT easier. The ugliness of Perl only became apparent when the data
> structures became deeply nested.
Pardon me for expressing my sever Perl bias here - but there is no such
thing as ugly code, only ugly programmers.
Go, find some code that is truly Ugly. For example, Duff's Device.
It's not the code itself that is ugly - it's the twisted mind behind it.
> Once I wrote a data structure sufficiently deep that, to access it, I
> could either use a dozen single use variables or one line and a huge
> comment.
If the data structure was truly that complicated, then there is no
language around that would make it "simpler". When you find yourself
thinking, "this code I wrote is UGLY" - what you're really saying is, "I
don't have a full realisation of the nature of the problem I'm trying to
solve, the nature of the solution, or the language I'm using to build
the solution."
Perl is much maligned because of things like insisting on curly braces
around blocks, even when they're one-liners (eg: every if () has a {}),
and the fact that regular expressions are in-line, not functions. Thus
you can potentially have three different grammars on the same line -
Perl, regex and substitution. Some people call it a "write only
language" because one person chooses to express their ideas using nested
hashes, while the next person expects to see arrays of arrays (one
person calls it a shovel, the other calls it a square nosed spade).
Anyhow, apologies for the rant. I'll go and answer another email in
this thread with something that is a closer approximation to helpful.
Alex
ALL programs are poems, it's just that not all programmers are poets.
-- Jonathan Guthrie
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 225 bytes
Desc: not available
Url : http://lists.samba.org/archive/linux/attachments/20020710/efd7a0f0/attachment.bin
More information about the linux
mailing list