Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re^3: Is this code correct

by Polyglot (Friar)
on Mar 23, 2021 at 05:03 UTC ( #11130179=note: print w/replies, xml ) Need Help??

in reply to Re^2: Is this code correct
in thread Is this code correct

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re^4: Is this code correct
by GrandFather (Saint) on Mar 23, 2021 at 19:52 UTC


    my $color = $form_inputs{color} // $user_color // $default_color;

    Using || in this context is simply wrong. If the user chooses black (some would say a valid choice) the user's choice is overridden, possibly generating a warning along the way.

    In this case warnings don't blatantly alert you to a key issue (|| instead of //), but they do give you a heads up to say that something needs attention. It is somewhat subtle, but the warning is telling you that the wrong operator is being used or inappropriate processing is taking place. Good warnings. Thank you warnings for helping me not shoot myself in the foot.

    Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond
Re^4: Is this code correct
by AnomalousMonk (Bishop) on Mar 23, 2021 at 05:20 UTC

    With which of these statements does the 'uninitialized' message originate?

    Give a man a fish:  <%-{-{-{-<

      Virtually all, if not all, of the "uninitialized" messages that I get are from hash values. I usually assign a null value to regular scalars at declaration, so there's no squawk about them.



Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11130179]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (1)
As of 2022-01-17 04:42 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (51 votes). Check out past polls.