Hi, relatively new to Perl and hoping that someone might be able to point me in the right direction. I want to accept a group of 1 or more user defined numbers ("thresholds") from a user running the script.
e.g. ./script 1000 8000 5000 2000

The script will read through each line of a file, searching for lines (specifically, the 10th element of each line) containing but not exceeding or crossing the boundries of each of the other thresholds

ie: If the thresholds are 1000, 8000, 5000, 2000, then search each line fo +r a threshold that is either -Greater than 1000, but less than 2500 -Greater than 8000 -Greater than 5000, but less than 8000 -Greater than 2500, but less than 5000

FYI: Each line of the file will resemble the following. The only part of this line that I am concerned with is the "Pending=XXXXX" element

2011-09-12 10:20:54.473 hostname [13996,14019]: (WALL, MDConnection.cp +p:420) Received data on Connection[OPRA-GRP13-16]. Pending=220. Total + Messages processed by Connection [OPRA-GRP13-16]=97190000

I have a simple script that that asks the user for a single threshold, then looks at the 10th element of each line, further tallying each instance for a final "count" of how many lines exceed this threshold. But am having a lot of trouble articulating any ideas on how to go about this; first looping through the array of thresholds the user gave me, then using that to create a single line of code (if statement, for example) that meets the criteria of the user specified thresholds. Is there an easy way to do this? Thanks

I'm not sure if it will be any use, but I can provide code examples of my current script, if necessary.

In reply to Any easy way to do this? by jb60606

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.