Re: Choosing only numbers from the output

2004-08-04 Thread Christopher J. Bottaro
this is an interesting question in that its not about syntax or a specific problem in perl. here's the algorithm: while there are lines to read from the input read a line split the line into two seperate strings around the colon if both strings are numbers

Re: Choosing only numbers from the output

2004-08-04 Thread Zeus Odin
You are correct. I did not properly look at the regex you passed to split. "Gunnar Hjalmarsson" <[EMAIL PROTECTED]> wrote > > The data as posted had white space trailing some of the digits > > after the colons. > > Yes, but how would that matter? Please read the second sentence in > "perldoc -f sp

Re: Choosing only numbers from the output

2004-08-04 Thread Gunnar Hjalmarsson
Zeus Odin wrote: Gunnar Hjalmarsson wrote: while () { my ($tag, $result) = split /[ :]+/; if ($result =~ /^\d+$/ and $result > 0) { ... The data as posted had white space trailing some of the digits after the colons. Yes, but how would that matter? Please read the se

Re: Choosing only numbers from the output

2004-08-04 Thread Zeus Odin
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; w

RE: Choosing only numbers from the output

2004-08-04 Thread Yacketta, Ronald
One way would be to split each line using : as the delimiter.. I am sure there are others, but I think split would be the easiest... IMHO From: sudhindra k s Sent: Wed 8/4/2004 5:48 AM To: [EMAIL PROTECTED] Subject: Choosing only numbers from the output Hi I have an output which looks

Re: Choosing only numbers from the output

2004-08-04 Thread John W. Krahn
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 sudhindra k s wrote: | | Hi Hello, | I have an output which looks like this: | | Tag : Result | 146603: | 147020: | 147155: NONE | 147160: | 147232: | 147243: | 147254: none | 147318: | 147341: NONE | 147430

Re: Choosing only numbers from the output

2004-08-04 Thread Gunnar Hjalmarsson
Sudhindra K S wrote: I have an output which looks like this: Do you possibly mean input? ;-) Tag : Result 148200: 148312: 38160 148329: 44139 148444: NONE 148514: 148573: 148697: Now i want to gather all the "Tags" for which the "Result" is a number (but shou

Choosing only numbers from the output

2004-08-04 Thread sudhindra k s
  Hi I have an output which looks like this: Tag : Result 146603: 147020: 147155: NONE 147160: 147232: 147243: 147254: none 147318: 147341: NONE 147430: N/A 147708: 147710: 147729: 147768: 147851: 147921: 147