in reply to "Modification of non-creatable array value attempted, subscript -1" Error

My brother at one time, long ago in the mid 90's, tried to create a program in Visual Basic without any programming experience... --He threatened to name his next dog, "Subscript Out Of Range." An array always has a size, even if it's empty. When you access array elements by their index number, you are, in less common terms, actually using a "subscript" number. In perl, array index/subscript numbers are positive integers starting at 0 for the first element. If an array is accessed in scalar context, it will return the number of elements in the array. If an array is empty in perl (no elements) and accessed in scalar context, it will return -1, an invalid index/subscript for all arrays. As a perl beginner, you're missing some of the basics, namely always use 'strict' and 'warnings' and while developing, also using 'diagnostics' can be real helpful.
#!/usr/bin/perl use strict; use warnings; use diagnostics; # this makes error messages nicer.
As for the problem with your code, I'd bet you have a blank line in your input file. You're not checking $_ (default input), so you'd be feeding an empty string into Net::Whois::ARIN.
#!/usr/bin/perl use strict; use warnings; use diagnostics; # this makes error messages nicer. use Net::Whois::ARIN; my $file="file_containing_IPs.txt"; open(LIST,$file) or die "Unable to open file $file:$!\n"; my $w = Net::Whois::ARIN->new( host => 'whois.arin.net', port => 43, timeout => 30, ); while(<LIST>) { foreach ($_) { chomp; if(defined $_ && $_) { my @output = $w->network($_); foreach my $net (@output) { printf( "CIDR: %s\tNetName: %s\tNetHandle: %s\n", $net->CIDR, $net->NetName, $net->NetHandle, ); } } } } close(LIST);