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?? |
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
In Section
Seekers of Perl Wisdom
|
|