Hi again all; Man this list is busy....
OK I am back to Solaris::Kstat Kstat is a Nested hash which can be displayed something like this foreach my $m (sort(keys(%$ks))) { foreach my $i (sort(keys(%{$ks->{$m}}))) { foreach my $n (sort(keys(%{$ks->{$m}->{$i}}))) { foreach my $k (sort(keys(%{$ks->{$m}->{$i}->{$n}}))) { print("$m.$i.$n $k = $ks->{$m}->{$i}->{$n}->{$k}\n"); } print("\n"); } } } But I dont want to loop through the thing. I already know what I want and am trying to insert the key value pairs into mysql but am running into a bit of a problem escaping quotes. Soo .... How would one turn this into an @rray of SQL which is returned from a subroutine. Sorry for the long post but here is where I am stuck sub get_kstats { ####################################################### # Desctiption: Collects stats from Solaris::Kstat # Arguments: NONE # RETURNS: @KSTAT_DATA # module.instance#.name key = value # print("$m.$i.$n $k = $ks->{$m}->{$i}->{$n}->{$k}\n"); # table solaris2_kstat ( # hostname char(50) not null, # pdate datetime not null, # kstat_module char(50) not null, # kstat_inst int default 0 not null, # kstat_name char(25) not null, # kstat_key char(25) not null, # kstat_value char(25) not null, ####################################################### use Solaris::Kstat; my $date = &get_date(); my $COLUMNS = "hostname, pdate, kstat_module, kstat_inst, kstat_name, kstat_key, kstat_value"; my $QHEAD = "INSERT into solaris2_kstat ($COLUMNS) VALUES("; my $kstat = Solaris::Kstat->new(); my $cpu_count = --($kstat->{unix}{0}{system_misc}{"ncpus"})|| die "You Have No CPU's!\n"; for (my $i = 0 ; $i <= $cpu_count; $i++) { my ($usr1, $sys1, $wio1, $idle1 ) = @{$kstat->{cpu_stat}{$i}{"cpu_stat"."$i"}} {qw(user kernel wait idle)};; my K_VALUES="'cpu_stat','$i','cpu_stat$i',THIS ISN'T PRETTY push (@KSTAT_DATA, "$QHEAD"."$KVALUES\n"); undef $KVALUES; } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]