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

Re: Perl Style: Is initializing variables considered taboo?

by FloydATC (Deacon)
on Aug 24, 2010 at 15:58 UTC ( #856971=note: print w/replies, xml ) Need Help??

in reply to Perl Style: Is initializing variables considered taboo?

If the undef has a significant meaning, I define it explicitly to make the code as clear as possible. Otherwise, I spend my keystrokes elsewhere. For example:
my $found = undef; foreach my $candidate (@candidates) { if ( good($candidate) ) { $found = $candidate; last; } } if (defined $found) { print "Found a good candidate: $found\n"; }

-- Time flies when you don't know what you're doing

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://856971]
[choroba]: Discipulus: I'm not sure what you really know and can code. But we have an interview process that should tell us :)

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (9)
As of 2017-06-29 13:30 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (666 votes). Check out past polls.