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 

 

Reply via email to