Greetings I am getting the following error when running a script using an anonymous array of hashes:
Bad index while coercing array into hash at ./nhsDiffSchema.pl line 240 Here is the code snipt that both assigns values to the array of hashes and the code which displays the values back (where the error is coming from) : * I have a scalar named $dataFiles that contains info similar to the following: export/spiderman1/ora_data_1/oradata/EHEALTH/SYSTEM01.dbf SYSTEM 250 160.61 89.39 1 89.39 35.76 YES Here is the code: my @dataFilesInfo=split /\n/,$dataFiles; foreach my $datafile (@dataFilesInfo) { next if $datafile =~ m/^$/; my @attributes=split /\s+/,$datafile; push @{$dataFileHash{$attributes[0]}},{ tableSpace => "$attributes[1]", allocMB => "$attributes[2]", usedMB => "$attributes[3]", freeMB => "$attributes[4]", numFrags => "$attributes[5]", maxFrag => "$attributes[6]", percentFree => "$attributes[7]", autoExtend => "$attributes[8]" }; } oreach my $datafile (sort keys %dataFileHash) { print "datafile : $datafile\n"; foreach my $record (@{dataFileHash{$datafile}}) { print "\tTablespace: $record->{tableSpace}\n"; print "\tMB Allocated: $record->{allocMB}\n"; print "\tMB Used: $record->{usedMB}\n"; print "\tMB Free: $record->{freeMB}\n"; print "\tNumber Frags: $record->{numFrags}\n"; print "\tMax Frag: $record->{maxFrag}\n"; print "\t% Free: $record->{percentFree}\n"; print "\tAuto Extend: $record->{autoExtend}\n"; }; } The error is coming from line 236, which is: print "\tTablespace: $record->{tableSpace}\n"; If I comment out that line, the error then goes to 237. So, it would seem I am accessing the values incorrectley some how but I can't seem to figure it out. I have used the Data::Dumper module to dump the contents of the array of hashes and it seems to be populated as I thought: $VAR1 = '/export/spiderman1/ora_data_1/oradata/EHEALTH/SYSTEM01.dbf'; $VAR2 = [ { 'usedMB' => '160.61', 'autoExtend' => 'YES', 'freeMB' => '89.39', 'allocMB' => 250, 'percentFree' => '35.76', 'numFrags' => 1, 'tableSpace' => 'SYSTEM', 'maxFrag' => '89.39' } ]; $VAR3 = '/export/spiderman1/ora_data_1/oradata/EHEALTH/NH_INDEX01.dbf'; $VAR4 = [ { 'usedMB' => '394.52', 'autoExtend' => 'YES', 'freeMB' => '86.48', 'allocMB' => 481, 'percentFree' => '17.98', 'numFrags' => 40, 'tableSpace' => 'NH_INDEX', 'maxFrag' => '57.13' } ]; ..... I am utterly confused as I have similar code that works correctley: my @tableInfo=split /\n/,$allTables; foreach my $table (@tableInfo) { my @attributes=split /\s+/,$table; push @{$tables{$attributes[0]}},{ table_space => "$attributes[1]", num_rows => "$attributes[2]" }; } foreach my $table (sort keys %tables) { print "table:$table\n"; foreach my $record (@{$tables{$table}}) { print "\tTablespace=$record->{table_space}\n"; print "\tNumber of rows=$record->{num_rows}\n\n"; } } I am using strict and when I enable warnings, I see the following message: Argument "NH_DATA01" isn't numeric in helem at ./nhsDiffSchema.pl line 236. I am not sure what that means and what 'helem' refers too. Help !! Thanks :) Jason -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>