Add some error reporting after interacting with the OLE object. It appears that $doc isn't being defined which would lead me to suspect that the OLE call is failing.
Update
To be more explicit, change line 19 to:
my $doc = $word->Documents->Open("$oldfile") or die("Couldn't open $ol
+dfile");