The entries you are missing in your output seem to be the numbers denoted by 'SW:'.
Neither of your regexes attempt to match for this at all. The 'SW;'
numbers also seem to have a unique trait that spaces are allowed as part
of the data. 'SW: 1.00.00 S'
The following is a modification of your loop that gives the output you specified.
while (<DATA>)
{
push @array, $1 if ( /Version:?\s*([^\s,]+)/i );
push @array, $1 if ( /SW:?\s*([^\n\r]+)/i );
}
Outputs:
:!./test.pl
$VAR1 = '12.2(15)T8,';
$VAR2 = '2.2.0.1';
$VAR3 = '9.0.0.2';
$VAR4 = '6.3(7)';
$VAR5 = '5.0.0.3';
$VAR6 = '2.1.2.1';
$VAR7 = 'E5.8.0.3';
$VAR8 = '1.00.00 S';
$VAR9 = '12.0(14)';
Hope that helps.
Wonko
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.