!/usr/bin/perl -w
use Win32::OLE qw(in with);
use Win32::OLE::Const 'Microsoft Excel';
$Win32::OLE::Warn = 3; # die on errors...
# get already active Excel application or open new
my $Excel = Win32::OLE->GetActiveObject('Excel.Application')
|| Win32::OLE->new('Excel.Application', 'Quit');
# get a new workbook
$book = $ex->Workbooks->Open('C:\Users\Andrew Babitt\Documents\ProductClonesTest.xls');
$Obook = $ex->Workbooks->Open('C:\Users\Andrew Babitt\Documents\NSS\extract_Products.xls');
my $billschedule = $Obook->clumn(B)->{value};
my $totalamount = $book->clumn(D)->{value};
my $opnum = $book->clumn(E)->{value};
my @array = (\$billschedule, \$totalamount, \$opnum);
my $var = 0;
while ($book->Range(0,0)->{value} ne '')
{
if (@array[0][$var] = $book->Range(0,9)->{value})
{
if (@array[1][$var] = $book->Range(0,10)->{value})
{
write(@array[2][$var], $book->Range(0,11)->{value});
}
}
else
$var = $var+1;
}