in reply to Re^2: Scripting data extraction from excel files in a directory.
in thread Scripting data extraction from excel files in a directory.

I used the eval method to be sure that $rowcounter was evaluated before the operation on the object was executed.
As to the string form of the eval , it is the only one known to me, are there any others?
Tabari
  • Comment on Re^3: Scripting data extraction from excel files in a directory.

Replies are listed 'Best First'.
Re^4: Scripting data extraction from excel files in a directory.
by Corion (Patriarch) on Jul 10, 2007 at 13:54 UTC

    You can be assured that Perl is sane in that respect. String-eval should be avoided in most cases, and in your case especially, as Perl works exactly how one would imagine, evaluating the expressions one after another. If you really are paranoid about the order Perl does things in, it helps to split up such long method chains into separate statements:

    # $rowval = eval "\$ex->Workbooks(1)->Worksheets(\'Versions\')->Cel +ls($rowcounter,1)->{Value}" ; my $wb = $ex->Workbooks(1); my $ws = $wb->Worksheets('Versions'); my $c = $ws->Cells($rowcounter,1); my $rowval = $c->{Value};