Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Need help with a nested IF statement

by leocharre (Priest)
on Nov 02, 2009 at 16:11 UTC ( #804486=note: print w/ replies, xml ) Need Help??


in reply to Need help with a nested IF statement

yo yo yo.. what's up with the indentation.. I'm just being bold about what others have stated indirectly.. It's not

if (..){ ... }
It's
if (..){ ... }
This is important. So you won't drive yourself insane looking through your own code. Consider Perl Best Practices by Damian Conway. It's a tedious book, and you don't have to eat all of it. But there's some real useful stuff in there about consistency and why.


Comment on Re: Need help with a nested IF statement
Select or Download Code
Replies are listed 'Best First'.
Re^2: Need help with a nested IF statement
by Anonymous Monk on Nov 02, 2009 at 16:49 UTC
    Indenting the lines containing the { and } is very strange, but at least it is consistent.
Re^2: Need help with a nested IF statement
by Anonymous Monk on Nov 03, 2009 at 01:01 UTC
    perltidy -pbp 804470
    $ifconfig = "ifconfig -a"; @nic = qx |$ifconfig| or die( "Can't get info from ifconfig: " . $! ); foreach (@nic) { if (/^fjgi([\d.])/) { $device = $1; if (/inet ([\d.]+)/) { print "test $1\n"; $ip = $1; } print "Device $device has the IP Address of $ip\n"; } }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (15)
As of 2015-07-31 21:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (282 votes), past polls