in reply to Re^5: Have you netted a Perl Monk or Perl Pretender in 5 minutes or less?
in thread Have you netted a Perl Monk or Perl Pretender in 5 minutes or less?

So are we admitting that this is a poor interview question? And bad design on the part of Perl in regards to statement modifiers? Compare...
#!/usr/bin/perl -w use strict; our $c = 2; print "Before: c=$c\n"; unless($c){my $c = 1} print "After: c=$c\n";
  • Comment on Re^6: Have you netted a Perl Monk or Perl Pretender in 5 minutes or less?
  • Download Code

Replies are listed 'Best First'.
Re^7: Have you netted a Perl Monk or Perl Pretender in 5 minutes or less?
by QM (Parson) on Sep 15, 2005 at 23:39 UTC
    So are we admitting that this is a poor interview question?
    This behavior of my is a fact. Precisely because of this fact, it's a good interview question. Knowing where the cracks in the armor lie is just as important as wearing the armor in the first place.

    -QM
    --
    Quantum Mechanics: The dreams stuff is made of

      Combining my with if/unless often leads to buggy behavior and is definitely not a "best practice". Things like the strange behavior of my $x if 0 (which is often used for "tricks") have been deprecated since 5.9.1 and will be removed eventually.