Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

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 filename.pm . it throws an error Can't locate Spreadsheet/ParseExcel.pm 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 test.pm line 4. BEGIN failed--compilation aborted at test.pm line 4. Please help me to run this script.thanks

Comment on how to run this script
Download Code
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.

    CountZero

    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: ./test.pm: Permission denied Please help
        when i do ./filename it gives error bash: ./test.pm: Permission denied
        You probably need to give your test.pm file execute permissions, like:
        chmod 777 test.pm

        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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://997519]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2014-07-22 08:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (106 votes), past polls