[PROGRAMMING] The joys of context
Aug. 13th, 2004 01:01 pmMay I just say, Perl is a bloody weird language?
Every couple of years I come across a project that requires some significant Perl hacking, and I brush it off. This time, I'm fiddling around in UseModWiki, to make it do what I want as a LARP-development environment. For the most part, that's entirely straightforward. But figuring out the appropriate syntax for dealing with my key data structure (a hash of hashes of arrays) is really mind-bogglingly tricky. I spent a good two hours just figuring out how to get things to dereference into the proper contexts, so that I stopped getting things like "ARRAY (0xabfoobar)" in my data files.
(Is there actually any documentation on the @{ } and %{ } operators? They're referred to all over the Perl docs, but I couldn't find anything actually telling me outright how you're supposed to use them, so I had to do a lot of trial-and-error experimentation.)
Oh, I'm sure that by the time I'm done, I'll have gotten my fluency back. But man -- after spending the past two years working primarily in C# and The Horror That Men Call ActionScript, Perl does require bending my brain into a pretzel...
Every couple of years I come across a project that requires some significant Perl hacking, and I brush it off. This time, I'm fiddling around in UseModWiki, to make it do what I want as a LARP-development environment. For the most part, that's entirely straightforward. But figuring out the appropriate syntax for dealing with my key data structure (a hash of hashes of arrays) is really mind-bogglingly tricky. I spent a good two hours just figuring out how to get things to dereference into the proper contexts, so that I stopped getting things like "ARRAY (0xabfoobar)" in my data files.
(Is there actually any documentation on the @{ } and %{ } operators? They're referred to all over the Perl docs, but I couldn't find anything actually telling me outright how you're supposed to use them, so I had to do a lot of trial-and-error experimentation.)
Oh, I'm sure that by the time I'm done, I'll have gotten my fluency back. But man -- after spending the past two years working primarily in C# and The Horror That Men Call ActionScript, Perl does require bending my brain into a pretzel...
(no subject)
Date: 2004-08-13 10:52 am (UTC)Bloody Weird Language
Date: 2004-08-13 10:55 am (UTC)But if I establish Flintstones = [Fred, Wilma, Pebbles, Dino]
and Rubbles = [Barney, Betty, BammBamm, Hoppy] and then pass them into a function "families (Flintstones, Rubbles)" and ask for array lengths, Flintstones has 8 members and Rubbles is empty! That drove me mad!!!!
-- Dagonell
Re: Bloody Weird Language
Date: 2004-08-13 11:06 am (UTC)Re: Bloody Weird Language
Date: 2004-08-13 11:47 am (UTC)Re: Bloody Weird Language
Date: 2004-08-13 03:59 pm (UTC)(no subject)
Date: 2004-08-13 11:03 am (UTC)I think it has only gotten wierder over time. I still pretty much limit myself to Perl 4 constructs; the rest still boggle the mind (and I'm actually worried about Perl 6).