I am a newbie to coding and perl.
I am trying to read names of excel worksheets in an excel file through Perl
Following is my code
#!/usr/local/ActivePerl-5.12/bin//perl -w
use strict;
use Spreadsheet::ParseExcel;
my $FileName = "/Users/labuser/Desktop/TestAutomation/Results.xls";
my $parser = Spreadsheet::ParseExcel->new();
my $workbook = $parser->parse($FileName);
die $parser->error(), ".\n" if ( !defined $workbook );
for my $worksheet ( $workbook->worksheets() ) {
print $worksheet;
}
But i am not able to get name of the worksheet through print $worksheet.
Please suggest how can i get that
you need to use:
in place of
Also use foreach: