in reply to Re^4: 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?
It tests the candidate's understanding of Perl syntax. To understand that line you must know the effects of using unless (and if I'm asking the questions that will quickly turn into what Perl considers true and false values) as well as execution order in a statement. Put concicely, it says that if $c exists and is true maintain it's value, otherwise set it to 1. It is an occasionally useful construct for fixing user input errors and the like.
I did notice that the way you've got it written it is a trick question - if you set the original value of $c to be 0 or "" the "my" would produce a warning about re-declaring a variable that was declared in the same scope.
I did notice that the way you've got it written it is a trick question - if you set the original value of $c to be 0 or "" the "my" would produce a warning about re-declaring a variable that was declared in the same scope.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^6: Have you netted a Perl Monk or Perl Pretender in 5 minutes or less?
by Anonymous Monk on Sep 29, 2005 at 15:37 UTC | |
by benrwebb (Scribe) on Sep 29, 2005 at 19:16 UTC |
In Section
Seekers of Perl Wisdom