Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

how to run this script

by kurtcobain (Novice)
on Oct 05, 2012 at 17:05 UTC ( #997519=perlquestion: print w/replies, xml ) Need Help??
kurtcobain has asked for the wisdom of the Perl Monks concerning the following question:

#!/usr/bin/perl -w use strict; use Spreadsheet::ParseExcel; my $parser = Spreadsheet::ParseExcel->new(); my $workbook = $parser->parse('siemens.xls'); if ( !defined $workbook ) { die $parser->error(), ".\n"; } for my $worksheet ( $workbook->worksheets() ) { my ( $row_min, $row_max ) = $worksheet->row_range(); my ( $col_min, $col_max ) = $worksheet->col_range(); for my $row ( $row_min .. $row_max ) { for my $col ( $col_min .. $col_max ) { my $cell = $worksheet->get_cell( $row, $col ); next unless $cell; print "Row, Col = ($row, $col)\n"; print "Value = ", $cell->value(), "\n"; print "Unformatted = ", $cell->unformatted(), "\n"; print "\n"; } } }
Hi, i started learning perl a couple of days ago. i try to run the above script with command perl . it throws an error Can't locate Spreadsheet/ in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at line 4. BEGIN failed--compilation aborted at line 4. Please help me to run this script.thanks

Replies are listed 'Best First'.
Re: how to run this script
by CountZero (Bishop) on Oct 05, 2012 at 17:09 UTC
    It seems you do not have Spreadsheet::ParseExcel installed.

    On the command line try "cpan Spreadsheet::ParseExcel". That should install it for you.


    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

    My blog: Imperial Deltronics
      thanks ..its working. whats the difference between running a perl script with command ./filename and perl filename . when i do ./filename it gives error bash: ./ Permission denied Please help
        when i do ./filename it gives error bash: ./ Permission denied
        You probably need to give your file execute permissions, like:
        chmod 777

        Also, conventionally, the .pm file name suffix is reserved for Perl module files (see package). It is more common to use the .pl file extension for scripts.

Re: how to run this script
by davido (Archbishop) on Oct 05, 2012 at 17:12 UTC
      set the permission..thanks guys

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://997519]
Approved by Corion
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2017-10-19 02:09 GMT
Find Nodes?
    Voting Booth?
    My fridge is mostly full of:

    Results (251 votes). Check out past polls.