I think a hash is more apt for this problem, but changing to (an) array(s)
is not difficult at all.

The data as posted had white space trailing some of the digits after the
colons. I found this worked better for me. Your results may vary.
;-)

#!/usr/bin/perl
use warnings;
use strict;

my %tag;

while (<DATA>) {
  /^(\d+)\s*:\s*(\d+)/ or next;
  $tag { $1 } = $2 unless $2 =~ /^0+$/;
}
 while ( my($k, $v) = each %tag ) { print "$k ==> $v\n"; }

__DATA__
146603    :
147020    :
147155    : NONE
.
.
.


"Gunnar Hjalmarsson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]

>      while (<DATA>) {
>          my ($tag, $result) = split /[ :]+/;
>          if ($result =~ /^\d+$/ and $result > 0) {
>              ...



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to