Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Thinking in perl

by K_M_McMahon (Hermit)
on Feb 18, 2005 at 08:10 UTC ( #432207=perlmeditation: print w/ replies, xml ) Need Help??

I'm sure I can't be the only one that this happens to. How many people out there find themselves just doing normal things and all of a sudden, your mind translates something totally unrelated into code.

Example1: I was at work the other day and somebody noted something on the white-board as if finish = 0300 then blah blah blah. Of course my mind didn't like that, I was compelled to go to the board and correct it to properly read  if finish == 0300 blah blah blah.

Example2: Everything becomes a regular expression in your head to the point where you wish everything in life could allow the use of regular expressions.

Example3: Sometimes I will be writing an email to the non-technical people I work with and I'll realize I have started including print statements, or some other perl function in my email (like I see on here all the time s/boss/idiot/g).

I am sure there are many more examples. Let me hear some!

my $a='62696c6c77667269656e6440676d61696c2e636f6d'; while ($a=~m/(^.{2})/s) {print unpack('A',pack('H*',"$1"));$a=~s/^.{2}//s;}

Replies are listed 'Best First'.
Re: Thinking in perl
by g0n (Priest) on Feb 18, 2005 at 09:48 UTC
    I once spent a drunken friday night helping my partner analyse her job in uml.

    She also maintains that I think the world was made in perl, to which the only possible answer is that it can't have been - it wouldn't have taken 7 days :-)

    Possibly even scarier, I once debugged a colleagues regex over lunch, without the aid of PC, paper, or pen. We sat there for half an hour saying things like: 's slash tilde backslash s curly bracket 4 close curly bracket backslash w plus.....'. We got a few odd looks, to say the least.

      Now imagine the blind perl programmer and the output of his screen-reader.
      Perl code is hard enough to read for someone that can see. This is no mean feat. Respect.

      holli, /regexed monk/
Re: Thinking in perl
by Juerd (Abbot) on Feb 18, 2005 at 10:42 UTC

    I'm known for typing and writing things like "Sure, but train ne boat", always write "==" instead of "=" for comparison, and tend to write objects with sigils prefixed: "and then $idiot just left", "I'm going to $office".

    But then, /me misses IRC commands (most importantly "/ignore") IRL, so YM probably V.

    Juerd # { site => '', plp_site => '', do_not_use => 'spamtrap' }

Re: Thinking in perl
by skx (Parson) on Feb 18, 2005 at 09:21 UTC

    Regarding your second point, over here in the UK there is a chain of betting shops known as Ladbrokes, the signs on the front of their shops look like this:


    The first time I saw this I thought "Hmmm, why don't they just write it in italice?". When I was enlightened I realised it was a not-very useful regular expression.

    I've heard a few people make similar comments about that sign!

Re: Thinking in perl
by dws (Chancellor) on Feb 18, 2005 at 17:14 UTC

    Last week, when helping my daughter get started on her math homework, I very nearly said "Remember to use strict;". (It'd been a loooong day.)

Re: Thinking in perl
by tbone1 (Monsignor) on Feb 18, 2005 at 14:12 UTC
    *nods* Happens to me quite a bit. Lately I've been dragged into a conversion project at work, and ProC keeps showing up in my dreams. Okay, nightmares. But yeah, I notice perlisms all the time, or try to convert things to perlisms in my head.

    At least it's not as bad as when I worked for a phone company. They use Universal Service Order Codes, or USOCs, as shorthands for everything. For example, to this day, nearly a decade later, I know that NSD means "Caller ID". When you spend your whole day dealing with NSD/NMP/N8D/and so one, you see USOCs all over the place.

    What's really bad is that I'm now working for a company in the medical/pharmaceutical market, and I still see USOCs! Except I have to remember that NDC is now "National Drug Code", not "Caller ID". Slight difference.

    tbone1, YAPS (Yet Another Perl Schlub)
    And remember, if he succeeds, so what.
    - Chick McGee

Re: Thinking in perl
by spurperl (Priest) on Feb 18, 2005 at 10:06 UTC
    Ack ! You mean the world isn't really made of code ?????
      That depends on who you ask I guess. All life contains DNA (Deoxyribonucleic acid) which many consider to be the code which builds the object living thing, kind of like a TK script and your birth (or fertilization) is the &MainLoop call.

      my $a='62696c6c77667269656e6440676d61696c2e636f6d'; while ($a=~m/(^.{2})/s) {print unpack('A',pack('H*',"$1"));$a=~s/^.{2}//s;}
        All life contains DNA (Deoxyribonucleic acid) ...

        Prions (only protien)
        retro-viruses (RNA)
        there are many more .. but i cant recall them at the moment!
        Hmm... i think ill take my pedantic hat off now...

        Im so sick of my Signature...
Re: Thinking in perl
by CloneArmyCommander (Friar) on Feb 18, 2005 at 22:03 UTC
    Hahaha :). You should see the notes I take in my physics and calculus classes :). I have them early in the morning and perl is usually the last thing I am doing the night before, so my mind is still in perl mode. So, my notes are one big block of (executable ;) perl code :). It if funny when someone asks if they can borrow my notes, because it is all gibberish to them. On the bright side, my note taking time is cut in half :). I just have to remember to chmod 755 before I can execute everything I learned, hahahaha :).
Re: Thinking in perl
by Popcorn Dave (Abbot) on Feb 18, 2005 at 18:57 UTC
    You're not. :)

    Often times when I'm knee deep in a project I will have recursive nightmares in Perl. The kind of dream where you just can't seem to solve a problem, wake up, and then as soon as you're asleep, bang - right back in to the nightmare.

    Useless trivia: In the 2004 Las Vegas phone book there are approximately 28 pages of ads for massage, but almost 200 for lawyers.
      That's a recurring nightmare. Now, if you'd been dreaming about dreaming about not being able to solve a problem...
        I don't know that I've gone quite that far. I've dreamed that I was dreaming before, but... :)
        Useless trivia: In the 2004 Las Vegas phone book there are approximately 28 pages of ads for massage, but almost 200 for lawyers.
Re: Thinking in perl
by neniro (Priest) on Feb 18, 2005 at 21:34 UTC
    Years ago my younger self, a happy commodore-amiga kid, very often thougt "undo". Today I often think there should be a kind of "use warnings;" for the real-life.
Re: Thinking in perl
by Ultra (Hermit) on Feb 19, 2005 at 16:57 UTC
    Two kinds of moments when i find myself thinking perl
    1) When writting mails i have the urge to write something like: "last if something" ;-)
    2) When writting C, i always find myslelf putting : int $var; or print "abracadabra";
    Dodge This!
Re: Thinking in perl
by fauria (Deacon) on Feb 21, 2005 at 00:35 UTC
    Well, i dont really 'think in perl', but i have to recognize that studying computer science and working with them makes me aproach problems in a more logical and structured way.

    I think that this science gives you the ability, even without your knowledge, of abstracting all kind of situations and thus solving them in an efficient way.

    This has reminded me an article about Jeff Hawkins, CTO of palmOne, who is researching a new theory about how the brain works. This theory has been accepted in the medical community. This is a great fact since Jeff Hawkins is an enginieer whithout a medical degree.
      I do dream about Perl, and normally come up with fantastic solutions to my real life problems in the dream, only to wake up and find that I can't remember them!

      The other day my friend was talking about a "pearl strings" (ie pearl necklaces) and I immediately thought of "perl strings". Clearly evidence that work should give me a week off before the psychologic damage becomes irreversible ;)

      Thanks for posting that reference to Jeff Hawkins book, it might be a handy reference for what I'm currently working on. I don't know how 'new' his theory is though - from the write up he seems to be elaborating on ideas that are not uncommon in cognitive modelling.

      If you want to see the other side of the argument, try Jerry Fodors 'The mind doesn't work that way: the scope and limits of computational psychology'.

      I quite agree about the value of studying science, as a way of developing logical approaches to problems. But I would say that there is value in learning any discipline (or ideally as many as possible - learn everything!). Studying history, particularly the Enlightenment period, gave me a useful insight into the origins of many of the concepts of science that we now take for granted, and the different approach to research provided a different, additional set of tools to use when approaching a problem.

      Now, off to Amazon in search of that book.

Re: Thinking in perl
by Anonymous Monk on Feb 21, 2005 at 14:48 UTC
    Every once in a while I'll say something stupid to my wife I wish I hadn't of said....I then visualize a quick "CTRL-Z" key combination in my head in the hopes I've undone that action in reality. It never works.
      My ex-husband used to actually say 'CTRL-U' in conversation.


Re: Thinking in perl
by g0n (Priest) on Feb 22, 2005 at 09:49 UTC
    use strict; my @answer = qw(Not so much perl as perlmonks - I recently tried to ++ + an article on the register. Doh!); foreach (@answer){print "$_ ";} print "\n";


      use strict;
      use warnings;
      use less 'java';
      print <DATA>;
      You forgot your she-bang and -w

      Linux, sci-fi, and Nat Torkington, all at Penguicon 3.0
      perl -e 'print(map(chr,(0x4a,0x41,0x50,0x48,0xa)))'
Re: Thinking in perl
by awwaiid (Friar) on Feb 20, 2005 at 22:29 UTC

    Last friday my brain was trying to trick me into sleeping through the alarm... I kept looking over at the time and then applying regexes to it so it would say what I wished!

    I had been having perl dreams all night before that too.

Re: Thinking in perl
by aufflick (Deacon) on Feb 21, 2005 at 23:51 UTC
    I often try to use tab completion in places where the computer would have to be reading my brain - like when writing an email...
Re: Thinking in perl
by gmpassos (Priest) on Feb 21, 2005 at 00:29 UTC
    Maybe you need to go out some time! Also you should use a fixed time to work, for example, only use the computer from 8AM to 17PM. Don't forget, life is too beautiful to see only a screen.

    Graciliano M. P.
    "Creativity is the expression of liberty".

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://432207]
Approved by inman
Front-paged by grinder
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2016-07-01 18:14 GMT
Find Nodes?
    Voting Booth?
    What is your favorite alternate name for a (specific) keyboard key?

    Results (14 votes). Check out past polls.