[Thamesvalley-pm] using third party perl scripts

Greg Matthews gmatt at nerc.ac.uk
Tue Oct 16 07:26:21 PDT 2007


Charlie Harvey wrote:
> Hey Greg,
> 
> Sounds like you need to use do or eval.
> 
> do EXPR

hrmmm.. not used that before... at the moment I'm using this approach:

     open(PCA, "$pca_bin $pca_opts |") or die "No fork: $!\n";
     my @result = <PCA>;
     close PCA;

and set $pca_bin to be the path to the perl utility. Is this acceptable? 
I'm using a very similar approach in order to use ssh from perl. It 
works but I'm not clear if this is best practice.

its not clear from the docs whether you can capture output from "do" (as 
I do above with the pipe).

G

> 
> Uses the value of EXPR as a filename and executes the contents of the
> file as a Perl script.
> 
>     do 'stat.pl';
> 
> is just like
> 
>     eval `cat stat.pl`
> 
> http://perldoc.perl.org/functions/do.html
> 


-- 
Greg Matthews           01491 692445
Head of UNIX/Linux, iTSS Wallingford

-- 
This message (and any attachments) is for the recipient only. NERC
is subject to the Freedom of Information Act 2000 and the contents
of this email and any reply you make may be disclosed by NERC unless
it is exempt from release under the Act. Any material supplied to
NERC may be stored in an electronic records management system.



More information about the Thamesvalley-pm mailing list