You should really take another (closer) look at perlre (or perhaps perlretut). Particularly the bits about using the match operator (m//).
my $count = 0; foreach (@input) { if (/DosID(.{6})/ and $count++ % 2) { $dosid = $1; } }
Of course, this overwrites the value of $dosid each time it finds a match, so you might need to change the logic a bit.
"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
In reply to Re^3: Alternative to Substr?
by davorg
in thread Alternative to Substr?
by New Novice
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |