Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Climbing Mt. Perlcritic -- Switch statements

by Marshall (Canon)
on Mar 25, 2009 at 19:07 UTC ( [id://753217]=note: print w/replies, xml ) Need Help??


in reply to Climbing Mt. Perlcritic -- Switch statements

I'm not sure how these various algorithms would score this code. But I would suspect highly that "flat code" is an objective, ie reducing the number of indent levels.

Here you have an if and then another if than can only be executed if the first if is true.

if ( /go/ && exists $files{$file}) { push @PLACE, @batch; delete $files{$file}; } if (/go/) { @batch=(); }
reduces the "if" indentation level by one. And moves this action that happens on /go/ "no matter what" up a level at the expense of testing it again. I'm curious as to how that would be "scored"?

Replies are listed 'Best First'.
Re^2: Climbing Mt. Perlcritic -- Switch statements
by chexmix (Hermit) on Mar 25, 2009 at 21:43 UTC
    Thanks for this ... I plugged it in and now the script is exhibiting some other weird behavior. I won't go into it deeply here b/c it would require discussing the script as a whole which I don't really need to do as yet ... in short, the output from the script has changed drastically, and not in the right way ;). So I have some kind of logic problem in that whole area of code ... I am tracking it down. Thanks for kicking my thinking in a different direction! G

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (4)
As of 2024-03-29 00:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found