#Call MathCad Win32::OLE->Option(Warn => 2); #use existing instance if mathcad is already running eval {$MC = Win32::OLE->GetActiveObject('MathCad.Application')}; die "MathCad not installed" if $@; unless (defined $MC) { $MC = Win32::OLE->new('MathCad.Application', sub{$_[0]->Quit;}) or die "Unable to start MathCad"; $MC -> {Visible} = 1; }