#!/usr/ym/util/perl use Win32::OLE; #use existing instance if mathcad is already running eval {$ex = Win32::OLE->GetActiveObject('Mathcad.Application')}; die "Mathcad not installed" if $@; unless (defined $ex) { $ex = Win32::OLE->new('Mathcad.application', sub{$_[0]->Quit;}) or die "Unable to start Mathcad"; }