Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hash - Min and Max values

Status
Not open for further replies.

bigbalbossa

Programmer
Mar 21, 2002
87
0
0
US
A delimited flat file contains two fields: List Number and Seq Number.

1|1
1|2
1|3
1|4
1|5
2|1
2|2
2|3
2|4
2|5

I need to find the min and max value for each list number. Seems easy enough...but i'm struggling.

Thanks All.
 
do you need to find if $1 >|< $2 line per line or do you need to find out the over all min and max values for the left fields, and the left min and max fields?
 
ok do you need to return list number 1 min = 1; max = 5; and list number 2 min = 1; max = 5;?
 
Exactly. I need to print:

List 1 - Min = 1 Max = 5
List 2 - Min = 1 Max = 5

Or something similar
 
This should be simple, what have you tried so far?

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
ok, do you already have a script that reads the file and puts them into a var $secular, %hash or @array? if you already do just post your code you have so far and I'll put it together.
 
I got it fellas. Wasn't difficult after i got some sleep :)

The code snippet above was simplified from my script. I was working with a hash of a hash...this worked:

$hash{$LIST_NUM}{FileSeqNum}=$FileSeqNum;

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top