Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: The error says the value is uninitialized, but it works anyway

by soonix (Abbot)
on Aug 21, 2019 at 13:02 UTC ( #11104813=note: print w/replies, xml ) Need Help??


in reply to Re: The error says the value is uninitialized, but it works anyway
in thread The error says the value is uninitialized, but it works anyway

if ($colors[$num] eq $drop[0] or $colors[$num] eq $drop[1]){ + splice (@colors, $num, 1); $num--; } $num++;
Just as a nitpick: I think it's better to
if ($colors[$num] eq $drop[0] or $colors[$num] eq $drop[1]) { splice (@colors, $num, 1); } else { $num++; }
because find it's somehow dopey (for lack of a better word) to decrement just to increment immediately afterwards.
With "else" it's clear that you need to increment only if the condition isn't met.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2019-11-17 22:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Strict and warnings: which comes first?



    Results (87 votes). Check out past polls.

    Notices?