Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

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 (..){ ... }
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.

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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://804486]
choroba needs more questions to provide answers to
jedikaiti looked at last hour of CB, saw "boos" but read "boobs"
[Discipulus]: 2 weekends ago LanX
[Lotus1]: cb is nsfw this morning
[Lotus1]: I wonder if ascii art would work in the cb....
[jedikaiti]: lolol

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2017-09-20 15:56 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (237 votes). Check out past polls.