Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: logical non-short-circuit operators

by ikegami (Pope)
on Nov 02, 2011 at 18:59 UTC ( #935475=note: print w/ replies, xml ) Need Help??


in reply to logical non-short-circuit operators

Why? Does field_as_text have a side effect? If so, it's poorly named.

If the assignments are the side effects you want to perform unconditionally, then move them out of the condition.

my $num = $recFono->field_as_text('102'); my $type = $recFono->field_as_text('104'); if ($num || $type) { ... if ($type) { ... } ... }

If it's a scoping issue, create a scope.

{ my $num = $recFono->field_as_text('102'); my $type = $recFono->field_as_text('104'); if ($num || $type) { ... if ($type) { ... } ... } }


Comment on Re: logical non-short-circuit operators
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (6)
As of 2014-08-30 03:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (291 votes), past polls