Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: When do you include the usual use pragmas in your example code?

by moritz (Cardinal)
on Aug 03, 2013 at 20:33 UTC ( #1047739=note: print w/replies, xml ) Need Help??

in reply to When do you include the usual use pragmas in your example code?

When I post a complete, runnable piece of code, I add the usual boilerplate. When I correct only a few lines of the OP's code, I don't.

I find it rather important to include the use 5.010; when I use say (which I do a lot, actually) in my examples, because the error message is often quite bad when you forget to include the pragma (often it complains that there is no method say, because perl parsed it as indirect method syntax).

And newcomers already have enough to struggle with, I don't want to increase their cognitive load by using a convenience subroutine that then makes their live harder.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1047739]
[ovedpo15]: how to fast count all hash keys with value 1? (if possible without loop)
[LanX]: scalar grep {$_ ==1 } keys %hash
[ovedpo15]: maybe even better question is if it possible to pash element to array from left. I mean that the element will enter array[0] and all other elements will move right +1

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2018-03-24 21:19 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (299 votes). Check out past polls.