Hello Monks,
I am trying to parse a csv file with a single software's inventory. The file contains system name, software name and version in each line. I am writing a script to find the number of instances of each version of software based on the major and minor version numbers.

For eg: When i look for major version 10, all the following should get counted 10.00.359, 10.01.1000, 10.02.2000 When i do a numeric comparison for this in my code i get warnings during run.

Argument "10.00.359" isn't numeric in numeric le (<=) at SWCompliance.pl line **

The code snippet is given below.

$ver = 10; #loop and split the line if ($ver <= $sw_fields[2]) { $by_sw{$sw_fields[0]}{$sw_fields[2]}++; $swvercount++; }
Am i doing something wrong or is there an alternate method?
Thanks in advance.
Joseph

2006-01-17 Retitled by planetscape, as per Monastery guidelines
Original title: 'Logical Operation - Numeric vs Sting'


In reply to Logical Operation - Numeric vs String by josephjohn

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.