This question was proposed to the room and got many answered, the result of the script did not change. Maybe I can show you what's going on and what I'm trying to do.

PERL Black Book mentions you can delete $array[index], it doesn't say there are limitations or anything. It makes it sound like you can delete ANY element by doing it like this but someone in the room said otherwise. Can someone explain this to me?

I have an array with blank values and I cannot get rid of them with grep, delete splice. To see what was actually contained that was causing problems, I used print "This is what we found: \"\""; and the result comes back literally "This is what we found: "". So it's empty and/or undefined.

Things I have tried:

@n = grep $_, @n;
@n = grep defined, @n;
@n = grep defined and length, @n;
for(my $count = 0; $count < @myarray; ) { unless(defined $myarray[$count]) { splice @myarray, $count, 1; } else{ $count++ } }
my $count = -1; foreach(@myarray) { $count++; if (!defined $_) { splice(@myarray,$count); #delete $myarray[$count]; } } No matter which of these I use, when I print out the array I get a han +dful of "Use of uninitialized value at line 55". Anyone have any sug +gestions as to why these little buggers won't go away?

In reply to Removing null values from within an array by coldfingertips

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.