map processes a list and returns a list, so your need to assign the list back to your @data array (or a new array).

@data = map { #? data is skiped when plotted if($maxreject[$i]) { $_ = "?$_" if($_ > $maxclip); } if($minreject[$i]) { $_ = "?$_" if($_ < $minclip); } $i++; $_; ######### YOU ALSO NEED TO PASS THE VALUE THROUGH!! } @data;

That said, a for loop might be a better choice, but it should work.

Update: As I said that your loop could be done as a for, I thought I ought show what I mean. I don't fully understand your algorithm, but either of the following would be functionally equivalent to your inner loop and (I think) they are somwhat easier to understand. Your choice is yours of course.

# as a for loop for (@data} { $_ = '?'.$_ if $maxreject[$i] && $_ > $maxclip or $minreject[$i++] && $_ < $minclip }; # or as a map, but different. @data = map{ $maxreject[$i] && $_ > $maxclip or $minreject[$i++] && $_ < $minclip ? '?'.$_ : $_ } @data;

Cor! Like yer ring! ... HALO dammit! ... 'Ave it yer way! Hal-lo, Mister la-de-da. ... Like yer ring!

In reply to Re: Using map by BrowserUk
in thread Using map by maderman

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.