http://qs321.pair.com?node_id=11130179


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

    Try:

    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 (Archbishop) on Mar 23, 2021 at 05:20 UTC

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


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

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