Hash Issue or Understanding
From: Bruce Phillip (Bruce_Phillip_at_emc.com)
Date: 10/30/03
- Next message: Gary Stainburn: "Re: Issue"
- Previous message: Brian Gerard: "Re: initialising a list of variables"
- Next in thread: Sudarshan Raghavan: "Re: Hash Issue or Understanding"
- Reply: Sudarshan Raghavan: "Re: Hash Issue or Understanding"
- Reply: Gary Stainburn: "Re: Hash Issue or Understanding"
- Maybe reply: Wiggins D Anconia: "Re: Hash Issue or Understanding"
- Reply: Roy Johnson: "Re: Hash Issue or Understanding"
- Maybe reply: Bruce Phillip: "RE: Hash Issue or Understanding"
- Maybe reply: Bruce Phillip: "RE: Hash Issue or Understanding"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
To: beginners@perl.org Date: Thu, 30 Oct 2003 03:17:11 -0500
Hi,
For those of you who helped me with my earlier scripts. Thanks.
But I have a further problem in understanding something. Using
The following declaration:
my %commands = ('sol'=>{'hostname' =>'uname -n',
'os' =>'uname -s',
'osver' =>'uname -r',
'osrel' =>'cat /etc/release
| awk \'{print $3}\'',
'srvtype' =>'uname -p',
'srvmodel' =>'uname -i | cut -f2
-d ","',
'memory' =>'prtconf | grep
Memory | awk \'{print $3}\'',
'cpu' =>'psrinfo | awk
\'{print $1}\' | wc -l'}
);
I have my code now as followed:
foreach $items (keys %commands) {
foreach $CMD (keys %{$commands{$items}}){
print "Command: $CMD \n";
$results=(&get_response($commands{$items}{$CMD}))[0];
print OUT_FH "$results,","";
}
}
The output works but it not in the order I expected:
I expected my output to be:
hostname, IP addrress, OS, Version, Release, Server Type, Model, Memory
Size, Total CPU's.
But what I got was:
Model, Server Type, cpu, Release, hostname, OS, Memory Size, Version
It seems to me the hash started almost at the bottom of the list instead of
With the hostname and work it way down. Is there any way to force the
Order other than maybe specifying the array itself?.
Phillip Bruce
ISC Consultant, System Architect
Location: Dublin, CA
* Cell: 408-476-8658
* Office: 925-560-7853
AIM: OkieUnix
- Next message: Gary Stainburn: "Re: Issue"
- Previous message: Brian Gerard: "Re: initialising a list of variables"
- Next in thread: Sudarshan Raghavan: "Re: Hash Issue or Understanding"
- Reply: Sudarshan Raghavan: "Re: Hash Issue or Understanding"
- Reply: Gary Stainburn: "Re: Hash Issue or Understanding"
- Maybe reply: Wiggins D Anconia: "Re: Hash Issue or Understanding"
- Reply: Roy Johnson: "Re: Hash Issue or Understanding"
- Maybe reply: Bruce Phillip: "RE: Hash Issue or Understanding"
- Maybe reply: Bruce Phillip: "RE: Hash Issue or Understanding"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|