sev: (Default)
[personal profile] sev
been awhile since I did any serious perlhacking.

I forgot that perl doesn't have a real live case/switch construction.

all my programming languages are squishing together in my head. damn.


This is here because even when I was coding on a regular basis I had to go look this up every time I wanted to do it:

    CASE: {
        ($line =~ /pattern/) && do{
            push(@array,$line);
            last CASE;
        };

        # ...more cases...
    }


...this is so much prettier, if somewhat less flexible, in C:

switch(line)
{
    case 'A' : do_something();
    break;

   /* more cases... */
}


given my fetish for regexps I probably wouldn't have been thrilled with the c-style solution anyway.

This long-standing confusion of mine is an example of why, when I was first learning perl, I used to take a notebook out to the fountain in hills plaza and write out my code longhand in a sick hybrid of perl and c and psesudocode, and then go back up to my office and translate it into real perl afterwards. it was *much* faster to do it that way than to try to muddle through at my keyboard and wonder why I couldn't get it to work. And the sunshine and the fountain and the cute gap girls were pleasant to stare at when I was stuck. (there was a satellite office for The Gap in the same building; they were a little weirded out by sharing an elevator with us scruffy geeks.)

I haven't thought about that place in years. That was my first fulltime tech job, nearly nine years ago. The little company I worked for is long-since gone -- which we saw coming; that's why so many of us developers jumped ship at the same time. Possibly hastening the company's demise. The only thing I really miss about that company was the insistance that we spend the time to learn *how* to do something before we tried to do it for real: "here, we'd like you to become the department IPC expert. take this book and play with it for awhile, and come back when you think you can write a client/server app with the following capabilities...we think it'll take you about a week to learn and a month to write." Can you imagine saying that to a junior engineer? (IPC = InterProcess Communication)

Profile

sev: (Default)
sev

March 2019

S M T W T F S
     12
3456789
1011 1213141516
17181920212223
24252627282930
31      

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jan. 26th, 2026 06:16 pm
Powered by Dreamwidth Studios