use warnings; use strict; # we are going be working with MS Word Objects use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Excel'; use Win32::OLE::Variant; my $text = ""; my $directory = "c:\\"; opendir (DH, $directory) || die "can't opendir $directory: $!"; # we are working with Word application my $Word = Win32::OLE->new('Word.Application', 'Quit'); $Word->{Displayalerts} = 0; # hide alerts $Word->{Visible}= 0; # we don't need to see Word in an active window my $Excel = Win32::OLE->GetActiveObject('Excel.Application') || Win32::OLE->new('Excel.Application', 'Quit'); $Excel->{Displayalerts} = 0; # hide alerts my $excelfile = "E:\\assin\\foo\\sample.xlsx"; my $root = "E:\\assin\\foo"; my $doc = "E:\\assin\\foo\\Functional.doc";