Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

The Marcel Perl Questionnaire

by mirod (Canon)
on Feb 23, 2001 at 15:48 UTC ( [id://60468]=perlmeditation: print w/replies, xml ) Need Help??

OK, so I needed a break last night and I have been watching the Actor's Studio and its final questionnaire a tad too much lately, so I came up with yet an other stoopid idea...

The Marcel Perl Questionnaire is a Perl version of the famous (?) Proust Questionnaire (which was not created by Proust by the way, he just answered it cleverly). The aim is to come up with a series of questions that reveal something on the questionnee's.

So here it is, with my answers:

Favorite Perl Instruction mapeven in void context {grin}
Least Favorite Instruction pack/unpackPerl Geek Code PU!
Favorite Looping Mechanism foreach
Least Favorite Looping Mechanism for( $i=0; $i<@array; $i++)if I wanted to write C I would use C
Favorite Module XML::TwigI wonder why! Narrowly beats Bone::Easy
Least Favorite Module XML::DOMNice module, but the DOM is an awful standard
Favorite Special Variable $/especially changing it while reading a file
Least Favorite Special Variable $. because it is not reset when reading several files through <>
Favorite variable type blessed scalarvery cool to use as object
Favorite Command Line Switch -p-P is cool too
Least Favorite Command Line Switch -sso much abuse is possible through this one!
Favorite Pragma overloaddespite the performance penalty
Favorite Regexp Modifier exealthough I try to stick to ex
Favorite Regexp Metachar \Lwe don't need no stinkin' upper case!
Favorite Descriptive Variable Name totoI am French!
Favorite HERE Doc delimitor THISor THAT
Favorite Filehandle INor... OUT

Replies are listed 'Best First'.
Re: The Marcel Perl Questionnaire
by tilly (Archbishop) on Feb 23, 2001 at 21:40 UTC
    My answers reveal a more boring mind I think.

    Favorite Perl Instruction sub I love closures
    Least Favorite Instruction reset Have you read the description of reset?
    Favorite Looping Mechanism foreach Why allow mistakes to be made?
    Least Favorite Looping Mechanism map If you won't use the return, why be confusing and obfuscate?
    Favorite Module Exporter Narrowly beat Carp
    Least Favorite Module Number::Format The bugs in it taught me things I didn't want to know about Perl.
    Favorite Special Variable $! Need I explain?
    Least Favorite Special Variable $` and $' Did I want the performance hit?
    Favorite variable type Anonymous hash Very flexible
    Favorite Command Line Switch -c Catch any typos in my incomplete edit
    Least Favorite Command Line Switch -u Is it worth the pain of getting this to work?
    Favorite Pragma strict Catch my typos please
    Favorite Regexp Modifier g Particularly in scalar context
    Favorite Regexp Metachar \w
    Favorite Descriptive Variable Name $_ Only when it makes sense though
    Favorite HERE Doc Delimiter EOT End Of Text
    Favorite Filehandle my $fh = do {local *FH}; What do you mean you didn't know that worked?

Re: The Marcel Perl Questionnaire
by redcloud (Parson) on Feb 23, 2001 at 21:28 UTC
    Hey, this is fun! Here's my take on things:
    Favorite Perl Instruction map I have to agree here. Brings back memories of using Scheme in college.
    Least Favorite Instruction format I just never have reason to use it
    Favorite Looping Mechanism postfix for A bare block with redo is a close runner up
    Least Favorite Looping Mechanism do {...} while (...) It's bass ackwards
    Favorite Module Data::Dumper Inspect those hairy data structures
    Least Favorite Module Anything that starts with XML:: I suppose I'll have to give in someday soon, though.
    Favorite Special Variable $_ It's where all the magic happens!
    Least Favorite Special Variable $] Fun for obfuscating, but "Its use is highly discouraged"
    Favorite variable type hash Like having a struct in C, but you can add elements on the fly!
    Favorite Command Line Switch -w Second runner up: "-MCPAN -e shell"
    Least Favorite Command Line Switch -U It's Unsafe!
    Favorite Pragma strict Of course! 8^)
    Favorite Regexp Modifier i I'm sooo insensitive. ;^)
    Favorite Regexp Metachar \Q Quote me, baby!
    Favorite Descriptive Variable Name $selfFresh-baked objects... yum!
    Favorite HERE Doc delimitor EOT"End Of Text"
    Favorite Filehandle STDERR always there when you need a friend....
Re: The Marcel Perl Questionnaire
by japhy (Canon) on Feb 23, 2001 at 23:16 UTC
    Here are my responses.
    Favorite Perl Instruction map() Oh, vestiges of LISP.
    Least Favorite Instruction vec() Perl and Bit Vectors. Ugh.
    Favorite Looping Mechanism naked blocks and redo Heheheh... "naked"
    Least Favorite Looping Mechanism while () That makes no sense to me. if () is a syntax error, and why should an empty condition be true?
    Favorite Module YAPE::Regex The OGRE will pound me to death if I say otherwise.
    Least Favorite Module less It doesn't do anything.
    Favorite Special Variable $| True booleans rock!
    Least Favorite Special Variable $* That is like, so retro
    Favorite variable type hash So malleable
    Favorite Command Line Switch -v perl -venereal disease
    Least Favorite Command Line Switch -U "Screw taint chec--"
    Favorite Pragma less use less anxiety;
    Favorite Regexp Modifier /sexgismo What's not to love?
    Favorite Regexp Metachar \z So tiny, yet so absolute.
    Favorite Descriptive Variable Name $q It's the CGI object variable.
    Favorite HERE Doc delimiter "END" Well, duh.
    Favorite Filehandle 0 Out of body experiences rock.


    japhy -- Perl and Regex Hacker
Re: The Marcel Perl Questionnaire
by danger (Priest) on Feb 24, 2001 at 00:43 UTC

    YAQ (yet another questionee):

    Favorite Perl Instruction #!/usr/bin/perl -w Oh, Perl instruction ... not perl instruction (nevermind).
    Least Favorite Instruction do the dishes Oh, you probably meant Perl instruction again.
    Favorite Looping Mechanism for(;<>;){} Yeah, well *everybody* does while(<>){}.
    Least Favorite Looping Mechanism goto But sometimes it is fun to mess with people's heads.
    Favorite Module Schroedinger::Cat Doesn't exist yet, but I'm dying to look in the damn box.
    Least Favorite Module English.pm Does anyone actually use this?
    Favorite Special Variable $_ Often used, seldom seen.
    Least Favorite Special Variable $[ What, you don't like saying 'The zeroeth element'?
    Favorite variable type hash Who doesn't like hashes?
    Favorite Command Line Switch -e From the cl of course, -w in a script
    Least Favorite Command Line Switch -X ook!
    Favorite Pragma strict What else?
    Favorite Regexp Modifier /gimeesex Replacement often resolves to 'do the dishes' though ...
    Favorite Regexp Metachar (?!pattern) Well, I count it as one metachar.
    Favorite Descriptive Variable Name $blah Blah!
    Favorite HERE Doc delimitor EOF But also HTML or SQL when appropriate.
    Favorite Filehandle DATA The DATA handle is quite handy at times.
Re: The Marcel Perl Questionnaire
by tadman (Prior) on Feb 23, 2001 at 23:07 UTC
    Joining the fray:
    Favorite Perl Instruction eval Endless fun, especially if you're not careful.
    Least Favorite Instruction goto Still haven't had to use it yet.
    Favorite Looping Mechanism map Despised for all the right reasons.
    Least Favorite Looping Mechanism for as foreach Say what you mean, mean what you say.
    Favorite Module HTML::Parser Or LWP::UserAgent, Inline::C, so many!
    Least Favorite Module Net::Traceroute Hack city
    Favorite Special Variable $@
    Least Favorite Special Variable $/ Whatever.
    Favorite variable type HoH At least memory is cheap these days.
    Favorite Command Line Switch -w Annoying, but for the betterment of all.
    Least Favorite Command Line Switch -w Some CPAN modules warn like crazy!
    Favorite Pragma strict Abuse me.
    Favorite Regexp Modifier sex You can't have enough 'x'
    Favorite Regexp Metachar \S Handy more often than not.
    Favorite Descriptive Variable Name $n Easy on the hands.
    Favorite HERE Doc delimitor FINAvoids confusion with __END__
    Favorite Filehandle CONF It's where you find out what to do
Re: The Marcel Perl Questionnaire
by Crulx (Monk) on Feb 24, 2001 at 01:21 UTC
    Favorite Perl Instruction study My favorite programming language can think. Can yours?
    Least Favorite Instruction select No, no, and no. The 4 arg version is fine, just like the C version. But they should have named the Perl specific one differently.
    Favorite Looping Mechanism foreach "But Dad! How can you hate... _The_KERNEL_?!?"
    Least Favorite Looping Mechanism grep It is just map { EXPR ? $_ : () } LIST. Some orthoginality is a good thing
    Favorite Module FileHandle How could you go wrong?!?
    Least Favorite Module Neural::Net It never was finished. I really should submit my own version one of these days.
    Favorite Special Variable $| You cannot go wrong with the autoflush
    Least Favorite Special Variable @F When was the last time YOU used -a
    Favorite variable type typeglob Cuz symbol tables remind me of Scheme.
    Favorite Command Line Switch -d Cuz my programs still have bugs
    Least Favorite Command Line Switch -U Hey, I'm glad that perl allows you to do unsafe things,
    but something had to go on the list
    Favorite Pragma subs I like to "use subs"
    Favorite Regexp Modifier   Perl regexps are a waste of time. Why would any real
    programmer deal with text. Hasen't Microsoft shown us
    that a text interface is utterly worthless. The metaphor
    of point and click is the ultimate in human computer
    interaction. All will obey and think only in point and click.
    Our keyboard should be replaced with a big letter "P" on
    our mouse. Then we could just hit the p over and over again.
    What need is there for regexp there huh? Don't you all see
    how easy it is to program GUI's? Especially ones like
    "Restart your computer? (ok)" Where is the need for
    a regexp there, I ask you? oh... um.... sorry bout that...
    I feel much better now. I like /g
    Favorite Regexp Metachar \f Formfeed RULZ!
    Favorite Descriptive Variable Name munge Munge, Munge, Munge.
    Favorite HERE Doc delimitor `EVIL` Spurrious commands galore!
    Favorite Filehandle ENSLAVED I like while(<ENSLAVED>)

---
crulx
crulx@iaxs.net
Re: The Marcel Perl Questionnaire
by jynx (Priest) on Feb 24, 2001 at 06:14 UTC

    here's more answers:

    Favorite Perl Instruction last So much power, so few keystrokes
    Least Favorite Perl Instruction eval Don't get me wrong, this is an extremely useful utility, but i always feel so guilty pulling it off the shelf
    Favorite operator ?: So quick to type,
    Least Favorite Operator ?: yet so much documentation to do also...
    Favorite Looping Mechanism quantified foreach One line to loop them and all, and one line...
    Least Favorite Looping Mechanism do {} until() just don't use it often
    Favorite Module File::Find Useful sysadmin tool
    Least Favorite Module Getopt.pl This is completely outclassed by the newer Getopt.pm modules.
    Favorite Special Variable @ARGVparse, strip, <>
    Least Favorite Special Variable $| always the last place i look for a bug...
    Favorite Variable Type Scalar It's a number, no wait it's a string, no a reference, wait wait, i've got it... ;-)
    Favorite Command Line Switch -i i'll save that file, thank you
    Least Favorite Command Line Switch -Mstrict ummm, wait a second, you mean it's not already in the file? Someone get me a rope...
    Favorite Pragma use Diagnostics; ding!  OH! So that's what that means...
    Favorite Regexp Modifier prefixed m LTS anyone?
    Favorite Regexp Metachar ? if less is more...
    Favorite Descriptive Variable Name $i You're already thinking of a loop, aren't you?
    Favorite HERE Doc Delimiter END obligatory
    Favorite Filehandle ARGV <> is my second favorite operator...

    nuf evah,
    jynx

Re: The Marcel Perl Questionnaire
by sierrathedog04 (Hermit) on Feb 24, 2001 at 18:42 UTC
    My favorite special variable is good old $_.

    Yesterday I realized that it is Perlish to assign variables to $_ explicitly. For instance, I can say:

    $_ = "LamourEstBleu"; if (/Bleu/){ print; }

    At one time I would have considered the above snippet to be obfuscated, because to a novice Perl programmer it is saying "Print something, but I am not going to tell you what to print."

    Now I see that this Perlish way of using $_ can make code clearer, by not repeating the variable name over and over again.

    If a variable is a proper name, then $_ is like the word "it". Most of us when speaking French/English whatever do not refer to a subject explicitly every time, but use implicit references like "it" as well, where the meaning of "it" is apparent from the context.

    Similarly, the meaning of $_, which is like the word "it" in spoken language, is apparent from context. As we deepen our own Perlishness I believe that many of us will use $_ more and more often. I know I will!

      Why? Again. Why?

      That variable has so many side-effects from normal processing that assigning to it is likely to bite you rather quickly.

      You can't use the impersonal pronouns (he/she/it in english) without first either using the actual noun, or unless the actual is strongly implied.

      Witness:
      "It runs." -- um, what does?
      "The dog has spots. It runs." -- now we know what runs.
      "The dog has spots. The cat has stripes. It runs." -- the dog or the cat?

      I don't know what others think, but I'd say you aren't solving a real problem by not using an actual variable name, but you might be causing some.

      Good variable names give clues about what is in that data structure, and how it would normally be used. $_ gives no indication anything.
      That is a bad habit, which if you are just starting you would be advised to break right now.

      Please see my comments in the thread starting at $_ haters anonymou for details of why.

      For the record, I am still not confident that I know all places where $_ will be used unexpectedly to me. You should not stomp over it thoughtlessly. Instead leave $_ alone before you have to ask how your map statement wound up eating up the array...

        As far as $_, I think that the problem of the many uses can be overcome by simply doing

        { local $_; # stuff... }
        .

        I haven't seen this do anything too weird, and it provides a good way to overwrite $_ temporarily. It sort of reminds me of elisp's (save-excursion ...) Anyway, here's my answers to the questionnaire -- favorites are first.
        (Least) Favorite Perl Instructionlocal; resetSee above. Why reset? Too dangerous, especially when you've got tons of single-char vars.
        (Least) Favorite Looping Mechanism{}; forNaked blocks give you more flexibility. for just seems useless to me.
        (Least) Favorite ModuleData::Dumper;Dump those objects! No least favorite -- I sort of like them all.
        (Least) Favorite Special Var$_; $]$_ is so useful. $] is not.
        Favorite Var TypetypeglobVery obfuscatable.
        (Least) Favorite Command Line Switch-e; -U-e allows me to do one-liners. -U does unsafe things.
        Favorite Pragmause strict; no strict "refs";Good for bugcatching, except when I want to use symbolic references.
        Favorite Regexp {Modifier,Metachar}i; \QYes to i! Too much work to manually decapitalize all the time. \Q useful for when arbitrary data comes in which you need to match.
        Favorite Descriptive Var Name%zNot very descriptive, but I like it nonetheless.
        Favorite HERE doc delimiterprint;Or some other command...
        Favorite FilehandleFOOShould be obvious why...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://60468]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2024-03-28 13:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found