http://qs321.pair.com?node_id=132586

mikeB has asked for the wisdom of the Perl Monks concerning the following question:

The code below has two foreach loop headers. The one commented out works (i.e., loop on index numbers). The one not commented out does not work, but seems like it should. It runs through the loop the proper number of times, but the ->{Name} element is undefined.

Any thoughts?

#!/usr/bin/perl -w use strict; use Data::Dumper; use Spreadsheet::ParseExcel; my $excel = new Spreadsheet::ParseExcel or die; my $book = $excel->Parse($ARGV[0]) or die; my $sheet; foreach $sheet (@{$book->{Worksheet}}) { #foreach (0 .. $book->{SheetCount}) { # $sheet = $book->{Worksheet}[$_]; print $sheet->{Name},"\n"; }