in reply to Passing Excel Objects in Perl

my ( $worksheet,@pageid,@plotname ) = @_;

... I do not think that word means what you think it means...

You may want to dump @pageid and @plotname, and then look at perlref.

use Data::Dumper; warn Dumper(\@pageid, \@plotname);

You are passing a scalar and two lists / arrays to your subroutine. Perl will flatten these and you will end up with the first array (@pageid) greedily eating all but the first parameter. To solve this, pass (and receive) the arrays by reference.

--MidLifeXis

Replies are listed 'Best First'.
Re^2: Passing Excel Objects in Perl
by Anonymous Monk on Jul 30, 2008 at 11:29 UTC

    The array's are passed sucessfully witht the help of my code.

    But I am not able to generate the excel sheet which i am expecting it to generate

    I Want my code to write the values of the array's to be written in two column's of the excel sheet

    In the code, the $worksheet is the object to the Worksheet

    That is not working properly in my code

      Unless the way you are passing the parameters is different from what you have shown, I am not certain that you are getting the data you expect into these variables.

      use strict; use warnings; use Data::Dumper; $Data::Dumper::Indent = 1; sub testme { my ($a, @b, @c) = @_; print Dumper(\$a, \@b, \@c); } print "===== 1 ======\n"; testme("a", qw(b c d), qw(e f g)); print "===== 2 ======\n"; testme("a", ('b', 'c', 'd'), ('e', 'f', 'g')); __DATA__ ===== 1 ====== $VAR1 = \'a'; $VAR2 = [ 'b', 'c', 'd', 'e', 'f', 'g' ]; $VAR3 = []; ===== 2 ====== $VAR1 = \'a'; $VAR2 = [ 'b', 'c', 'd', 'e', 'f', 'g' ]; $VAR3 = [];

      --MidLifeXis