February 2023

S M T W T F S
   1234
567891011
12131415161718
19202122232425
262728    

Style Credit

Expand Cut Tags

No cut tags
Tuesday, July 23rd, 2002 12:50 pm
I'm getting more motivated at work. I have ONE script that needs debugging... in a language I don't "speak". This is actually fun.

The car place still has my car. Had to skip the gym this morning for lack of car. It @#$ing well better have air conditioning when they're through with it. They replaced nearly every part in the A/C system just weeks ago.

Quote of the day: "WARNING: The consumption of alcohol may leave you wondering what the hell happened to your bra."
Tuesday, July 23rd, 2002 05:20 pm (UTC)
Yeah, there's a lot of that attitude in Perl culture. There's probably also more bad programming done in Perl than in most other languages. I think the reason for this is how Perl came into prominence.

Though Perl was used for years before the web was around, it was only known by a few crusty Unix people that normal humans probably wouldn't communicate with. (Apologies to those of you who fit this mold who are probably reading this. You know who you are. :-) I claim partial exemption being one of them myself.) Perl was an obvious choice for a lot of web interactivity, particularly with the release of Perl 5, about simultaneous with AOL putting people on the net and the web exploding.

Anyway, Perl is ultimate among languages that let you do a great deal with very little. Because of this, and books like Learn Perl in 8 Seconds Without Thinking, probably by Sams, a lot of non-programmers picked up a little syntax and were actually able to produce sorta-working stuff.

I think most of the thinkers of the thoughts that you've described are people who fall into this category. They're people without a solid grounding in computing, have little experience with other languages and probably lack the skill required to easily pick up other languages and tools. The swagger is a little defensive in most of the people who have it.

Now... that said, Perl does all kinds of rule. If you're actually good at programming, and happen to be working in the problem spaces at which Perl excels (which used to be a smallish space, but now includes mostly things not graphically oriented or very low level where the overhead of Perl becomes important), Perl is in my ever so humble opinion the best choice. It's flexibility, power and speed of development are just hard to rival with any other language.
Tuesday, July 23rd, 2002 05:37 pm (UTC)
That's pretty much my understanding of Perl's history, too. It's very clear it comes from the Unix side of things (which is a little odd right there -- Windows / DOS have much WORSE existing shellscripting capability, so it's arguable that Perl is needed more on those platforms). It seems that only lately is Perl branching out of its niche as purely a system administrator's tool.

My own theory is that a swagger is almost always defensive whether in a Perl coder or not :-) but that's another topic.

Many many thanks for the offer of help! I'm enjoying tweaking this thing, and I just may take you up on your offer if I get stuck.
Wednesday, July 24th, 2002 03:39 pm (UTC)
I agree with you about the defensive thing. I feel the same way about arguing. Most people only do it when they are unsure of their own views. I mean, if someone at a party asserts that 2+2=5, you'd be amused, and probably egg the person on if they were serious. You wouldn't have an argument about it. But have someone criticize your religious views or morals, and... well you get the idea.

And you're welcome about the offer to help. I have a lot of fun with Perl, and even more fun with people who are new to learning it. I'd be happy to be of any assistance that I can.
Tuesday, July 23rd, 2002 06:00 pm (UTC)
Perl is also the most playful language I've seen, though. The true geeks produce esoteric, linenoiselike perl just because they can, and because the results are so beautiful (like (not mine!) $max = [$a=>$b]->[$a<=$b];). It's not an "I know things not meant for mere mortals" swagger, more of a "w00t - see what I got this thing to do!" wardance.

For actual serious coding I've defected to the Ruby camp, though there's still nothing to touch cpan.
Wednesday, July 24th, 2002 04:00 pm (UTC)
$max = [$a=>$b]->[$a<=$b];

This is mildly clever. I'll disect it for the benefit of readers who may not be able to parse it.

Square brackets are an anonymous list constructor in Perl. What results is a scalar value that is a reference to a list. So:

$foo = [1,2];
is the same as:
@foo = (1,2);
$foo = \@foo;

=> is syntactic sugar, and is a synonym for ',' , so what you've done with the first part of the expression is an (anonymous) reference to a list containing $a and $b. It is a cool way to write it because it looks like numeric comparison, but actually does nothing of the sort.

Now, the '->' is the arrow operator used to dereference in Perl. When followed by square brackets, it is expects to dereference a list reference. For instance, with our foo example above, we'd get the first (zeroth, actually) value of @foo with:

$foo->[0];

So... $max = [$a=>$b]->[...];

intends to dereference the anonymous list and access the numerical value indicated by '...'. What is actually contained in that is, this time, an actual numeric comparison is being done with $a<=$b, which if false, will generate 0, the zeroth element, and if it is true, it will be equivalent to 1, giving the other element of the list.

And in more general terms, you are correct... there is more of this in Perl than anywhere else I've ever played, and it is among the multitude of reasons that I love Perl and Perl culture.

If you disliked this bit of fun, you are almost certain to not enjoy the Fun With Perl mailing list, accessible from http://lists.perl.org/ . This list has frequent mailings of things of this sort, along with other things like Perl Golf contests. These last are seeing who can perform a specified task in the fewest number of (key)strokes. You'd be amazed what Perl masters can do in 60 or strokes... I've never seen a problem posed that took more than that. Of course, the winning solution always look like this:

-ni
$_=$#@*(%(#$@#___;eval

so it has little value until you get enough the hang of it to be able to parse those things... but once you have the basics, decoding those and asking questions about them is extremely educational.

I personally suck at these in that I've been programming Perl too long to justify entering those contests in the "beginner" category and yet I can't generally score well even for a beginner, let alone with the main group.

(Anonymous)
Thursday, July 25th, 2002 07:17 am (UTC)
mmm, excessively-clever perl. great for personal hacks, or contests... I think I'd slap anyone who checked that in on my current project :-) (now, if it became an established idiom, that'd be another thing, or if it had a comment, or if there was some reason it was actually *clearer* than the classic version.)
perl has made inroads into the dos space, via ActiveState, especially on the web side of things... but vb/vbscript covered a lot of the "needs more scripting" niche, much to the horror of unix geeks :-)
but yeah, you can always ask for help, even "don't tell anyone I asked, but..." form; you just risk getting long digressions about how some feature evolved from perl 3 :-)

"perl is the yiddish of programming languages"
_Mark_