Re: Array of Hashes?

2001-09-24 Thread register
You can do a schwartzian transform @hosts = (blah..blah..blah); my @sorted = map { $_->[0] } sort { $a->[1] cmp $b->[1] } map { [$_,$_->{name} } @hosts; foreach my $h (@sorted) { foreac

Array of Hashes?

2001-09-24 Thread Batchelor, Jonathan
I have a data structure similar to the following: @hosts = ( list of hashes like below ... ); %hosts = ( name => "hostname", ipaddr => "www.xxx.yyy.zzz", location => "location" ); How can produce a sorted list of the hashes based on the hostname and then acce

RE: Trying to create array of hashes

2001-08-01 Thread John Edwards
inal Message- From: Bradley Wendelboe [mailto:[EMAIL PROTECTED]] Sent: 01 August 2001 17:35 To: 'John Edwards'; [EMAIL PROTECTED] Subject: RE: Trying to create array of hashes The command generates multiple 'records'. Each one of these 'records' are divided by

RE: Trying to create array of hashes

2001-08-01 Thread Bradley Wendelboe
IL PROTECTED]] Sent: Wednesday, August 01, 2001 11:30 AM To: 'Bradley Wendelboe'; [EMAIL PROTECTED] Subject: RE: Trying to create array of hashes This should get you started. You don't mention how you are collecting you inital data. Do you run a command several times with different

RE: Trying to create array of hashes

2001-08-01 Thread John Edwards
. How to do an array of hashes depends on the above --- @data = ("object manager name: snmpCollect", "state: RUNNING", "PID: 463", "last message:Initialization complete.", "ex

Trying to create array of hashes

2001-08-01 Thread Bradley Wendelboe
Hello, I'm trying to capture the output from a command a slice and dice it into an array of hashes. The data looks like this: object manager name: snmpCollect state: RUNNING PID: 463 last message:Initialization complete. exit status: - o

Re: Printing a array of hashes of hashes of arrays

2001-07-31 Thread Michael Fowler
On Tue, Jul 31, 2001 at 05:34:39PM -0500, Chris Garringer wrote: > I have a program that has an array of days of the month, the array value > $is a hash, the value of the hash is a hash, and its value is an array > $logs[$day]{}{}[] [snip] > Can someone show me how I can print this out? Why are y

Printing a array of hashes of hashes of arrays

2001-07-31 Thread Chris Garringer
I think that is right, I admit that Perl's data structures confuse me and I don' t have it right yet. I have a program that has an array of days of the month, the array value is a hash, the value of the hash is a hash, and its value is an array $logs[$day]{}{}[] This structure works fine to loa

Re: looping over an array of hashes

2001-06-01 Thread Walt Mankowski
On Fri, Jun 01, 2001 at 03:29:43PM -0700, Chuck Ivy wrote: > First post, quick question: > > I've got an array of hashes that I'm defining the most basic way I can... > > my $gSeasonID; > my @season_list = ''; > while (@fields = $sth->fetc

Re: looping over an array of hashes

2001-06-01 Thread Bill Stilwell
On Fri, Jun 01, 2001 at 03:29:43PM -0700, Chuck Ivy wrote: > First post, quick question: > > I've got an array of hashes that I'm defining the most basic way I can... > > my $gSeasonID; > my @season_list = ''; > while (@fields = $sth->fetc

Re: looping over an array of hashes

2001-06-01 Thread Chas Owens
This can be corrected by writing you sql like this (please adjust for your flavor of sql): select a.id, b.name as b_name, a.name as a_name from tab1 a, tab2 b where a.id = b.id; On 01 Jun 2001 15:29:43 -0700, Chuck Ivy wrote: > First post, quick question: > > I've got an arr

looping over an array of hashes

2001-06-01 Thread Chuck Ivy
First post, quick question: I've got an array of hashes that I'm defining the most basic way I can... my $gSeasonID; my @season_list = ''; while (@fields = $sth->fetchrow_array) { $gSeasonID = $fields[0]; $season_list[$gSeasonID]{number} = $fields[1

<    1   2