Hi maikelnight!,
First when you post a question here, the ideal situation is that you provide a completely runnable example including a sample of the data. That way I can just download the code into my Perl environment, push the "go button" and replicate exactly what you are seeing. update: Basically the easier you make it for the Monks to run your code, the more likely you are to get a prompt and good response. Right now I'd have to work my brain a bit to reverse engineer some data that would produce your results. Things are much better if I don't have to do that.

Do you have use strict; use warnings;? That is important. It looks like @cleared is an AoA (Array of Array), i.e. a 2-D structure. This code: ($x =~ m/^Something Else/) won't work because $x is a reference to an array. You need $x->[someIndex]to get a string to compare against. I am surprised if what you have doesn't throw some kind of an error? Why don't you rename $x, $row_ref or something like that? $x is not very descriptive.

This does look weird:

unless ($x =~ m/^Something Else/){ print "~~Something Else~~", $x, "\n"; }
That is the same as: print ~~Something Else~~ if $x is not Something Else , which is kinda weird.
if ($x->[someIndex] !~ m/^Something Else/){}
Does that help?

Enclose the output in code tags so that we can see the line breaks.


In reply to Re: Loop Array - If $var is something write values until $var is something else by Marshall
in thread Loop Array - If $var is something write values until $var is something else by maikelnight

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.