Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Use of uninitialized value $i in bitwise and (&) at <Netmask.pm>

by Eily (Monsignor)
on Dec 18, 2017 at 09:23 UTC ( [id://1205783]=note: print w/replies, xml ) Need Help??


in reply to Use of uninitialized value $i in bitwise and (&) at <Netmask.pm>

Hello dotowwxo, welcome to perl and to the monastery.

Data::Dump is a useful tool for debugging. Add use Data::Dump qw( pp ); at the top and then you add: print '@row is now: '.pp(@row)."\n"; inside your loop. You'll find that it only ever has one element, that's because @row = $row replaces the content by $row only. Also my declares (creates) a new array, so even if you didn't replace the content, is starts empty anyway.

You can read all the lines in an array like this: my @rows = <$fh>; Then you can simply remove the while loop and use only the inner one.

Edit: I renamed @row as @rows, because hippo is right

Replies are listed 'Best First'.
Re^2: Use of uninitialized value $i in bitwise and (&) at <Netmask.pm>
by dotowwxo (Acolyte) on Dec 19, 2017 at 02:41 UTC
    Hi, thank you for your recommendation. Tried debugging and your recommendation by removing the outer loop, it gave me the same results. I still don't see the issue why that error is produced. I am suspecting it to a problem/bug of the netmask module. I will try using other modules instead. Thank you again :)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (5)
As of 2024-04-18 19:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found