use strict; use Win32::OLE; use Win32::OLE::Const 'Microsoft Word'; my $wd = Win32::OLE::Const->Load("Microsoft Word 10.0 Object Library"); my ($pages,$doc); my $Word = Win32::OLE->new('Word.Application', 'Quit'); # $Word->{'Visible'} = 1; # if you want to see what's going on my $doc = $Word->Documents->Open("P:\\My DOCUMENTS\\test.doc") || die("Unable to open document ", Win32::OLE->LastError()); $pages = $doc->Information($$wd{'wdNumberOfPagesInDocument'}) || die("Unable to open property ", Win32::OLE->LastError()); print "The number of pages in test.doc are: $pages"; exit;