Hi. I am really new using perl (by new I mean I have 3 days using it :s ) and I was requested to create an application that reads an Excel file and load info into the database. I was able to find how to do this, It worked perfectly on my computer, but when I try to load it in the web server for it to be accessed remotely, I get weird information as a result. I read about this and I found out that it has something to do with the way perl represents the different data_types. Here is the info I get: Win32::OLE::Variant=SCALAR(0x2004638). This is what I get on fields that are date formatted in the excel spreadsheet. Can anyone help me find out why I get different results in both computers? and if there is any way I can convert this Win32::OLE::Variant=SCALAR(0x2004638) into the date I need to store? here is the code I use: (I have commented the place where I put the information into a bidimensional array to send it to a function that stores it to the DB, and replaced it for code that just prints it to the screen)
use Win32::OLE; my $acum = 0; my $file2Parse = "c:/failureFile.xls"; my @DBrow; my @DBResult; my $ref; $row = 1; $ex = Win32::OLE->GetActiveObject('Excel.Application'); $ex = Win32::OLE->new('Excel.Application') or die "Oops, canno +t start Excel"; # get a new workbook $book = $ex->Workbooks->Open($file2Parse) or die "no file open +ed"; # write to a particular cell $sheet = $book->Worksheets(1); while ($acum!=17) { $acum = 0; for ($column=1;$column<=17;$column++) { print $sheet->Cells($row,$column)->{Value}."||"; # $DBrow[$column-1] = $sheet->Cells($row,$column)->{Value +}; if ($sheet->Cells($row,$column)->{Value} eq "") { $acum++; } } if ($acum != 17) { # $DBResult[$row-1] = [@DBrow]; } $row++; } $book->Close; undef $book; undef $ex;
thanks in advance for any help you can give me.

In reply to Data Types and Win32::OLE by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.