use strict; use warnings; use Win32::OLE; my $xlsFile = "c:\\temp\\myexcelfile.xls"; my $excel = Win32::OLE->new('Excel.Application', 'Quit'); my $book = $excel->Workbooks->Open("$xlsFile") or die; if($book->{ReadOnly}+0 > 0){#the funny +0 is an easy way to force the scalar to be interpreted as a number warn "$xlsFile is open Read Only!"; $book->Close; $book = undef; $excel = undef; }