Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Re: A Perl aptitude test

by TheDamian (Priest)
on May 02, 2003 at 22:39 UTC ( #255188=note: print w/replies, xml ) Need Help??


in reply to Re: A Perl aptitude test
in thread A Perl aptitude test

the only one I think is a bit unreasonable is #1, because it is code you wouldn't normally ever expect to write except in error.

I think the problem with the question is that the parens are there only to be "tricky". The error would be more understandable if the parenthesized operation was of lower precedence.

So I'd have posed the question like this:

  1. The following line of code is an example of a common coding error in Perl:
    print (2 + 3) * 4;
    1. What does the statement print?
    2. Why?
    3. How could you fix it?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://255188]
help
Chatterbox?
[1nickt]: What do you all think of experimental = refaliasing ? Anyone using it?
[1nickt]: \my %foo = { bar => 1 }; say $foo{bar};
[Corion]: 1nickt: Would be great, especially for naming parameters in @_.
[Corion]: When you pass an arrayref, you get to treat it like a local array. But then, I'm cautious with the experimental features, because just when I thought function signatures were a set thing, there is a proposal to use sub [ $foo, $bar ] { ... } to ...
[Corion]: ... declare the parameters, instead of the more common sub ($foo, $bar) { ... }

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2017-11-17 20:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (272 votes). Check out past polls.

    Notices?