Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

kappa (294)

  (email not shown publicly)

Perl Hacker since 1998. Lives in Moscow, Russia.

Journal of kappa (294)

Thursday January 21, 2010
09:15 AM

.. & ...

[ #40116 ]

I'm publishing one of the tricky questions I ask when I interview people for Perl developer positions.

"Tell me about .. and ... operators? How are they different? How do they work in different contexts?" © skv++

Why it is a bad question: nobody (and I mean, really, nobody) ever uses these operators in scalar context. The only way to really know them is to have literally learnt all the perlop by heart. I once did it because I studied Perl offline and the information to feed upon was very scarce.

Why it is a good question: it allows me to know whether the man understands Perl contexts in 30 seconds.

IMHO, this question brings more grief than benefit so I hereby decide to ditch it. Hooray!

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • nobody (and I mean, really, nobody) ever uses these operators in scalar context

    I'm not saying it's common, but I've certainly used those operators in scalar context.

    while (<SOMEFILE>) {
      print if 10 .. 20;

    Or perhaps:

    while (<SOMEFILE>) {
      print if /START/ ... /END/;