In your code, you appear to have an "s" in the wrong place:
foreach my $ip (@ips) { $record[7]=$ip; $csv->print ($ips, \@record); #Error probably here (ips -> ip) }
probably what you need is: $csv->print ($ip, \@record);.

If you were using use strict; use warnings; This should throw a compile error because the scalar $ips is not defined.

One thing to consider is avoiding variables that differ by just a single letter (ips vs ip). It is very easy to make a typing mistake and get confusing results. Also be aware that in Perl, a symbol like "ips" can be both an array variable @ips and a different scalar variable like $ips at the same time. Not everything that is possible is wise. Just for consideration, assuming you keep @ips as is:

foreach my $cur_ip (@ips) #or perhaps $this_ip or other name? { $record[7]=$cur_ip; $csv->print ($cur_ip, \@record); }
Of course I have no context, but probably I would wind up changing @ips to something else: @local_ips, @network_ips, some name describing what kind of ips these are and keeping the simple $ip for the loop iterator name.

In reply to Re: Use of uninitialized value in subroutine entry by Marshall
in thread Use of uninitialized value in subroutine entry by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.