http://qs1969.pair.com?node_id=1057455


in reply to Re^5: Iterating Through Cell Blocks with Spreadsheet::Read
in thread Iterating Through Cell Blocks with Spreadsheet::Read

[from Re^2: Iterating Through Cell Blocks with Spreadsheet::Read:]
I still get the same error "Use of uninitialized value in concatenation (.) or string at..." on the print statement after replacing lines like "$name = $sheet{"$_28"}" with "$name = $sheet{"${_}28"}".

I'm assuming the error message quoted from an earlier reply refers to the code most recently posted. In this code, my interpretation of the
    my $sheet = $book->[$sheet_index] or next;
statement is that it creates a hash reference named $sheet. If you dump this variable with something like
    print Dumper $sheet;
is that what you see? If the scalar  $sheet is a hash reference, its elements are accessed like  $sheet->{'string'} (note the  -> operator; see The Arrow Operator in perlop; also see perlref).

After that, statements like
    $name = $sheet{"${_}28"};
assign values of keys of the hash named  %sheet (not the hash reference  $sheet) to variables. Does this hash exist? It is not shown in your posted code, and I don't understand how your code can possibly work if it does not exist. Are you aware of the phenomenon of "autovivification" in Perl?

Do you have warnings and strictures (see warnings and strict) enabled, i.e., do you have statements like
    use warnings;
    use strict;
at or very near the top of each source file? Bugs arising from autovivification direct-versus-referential access confusion can easily bite without warnings and strictures.

Update: On second thought, the reference to autovivification above is misguided, but the hash  %sheet really does have to exist somewhere with meaningful data in it for the posted code to work.