in reply to using bash commands in perl program

You can run bash thru IPC::Open3. Here is a super simple example. You can add alot more complexity by doing a Select on the output filehandles.
#!/usr/bin/perl use warnings; use strict; use IPC::Open3; $|=1; #my $pid=open3(\*IN,\*OUT,\*ERR,'/bin/bash'); my $pid=open3(\*IN,\*OUT,0,'/bin/bash'); # set \*ERR to 0 to send STDERR to STDOUT my $cmd = 'date'; #send cmd to bash print IN "$cmd\n"; my $result = <OUT>; print $result;

I'm not really a human, but I play one on earth Remember How Lucky You Are

Replies are listed 'Best First'.
Re^2: using bash commands in perl program
by Anonymous Monk on Jan 05, 2009 at 17:11 UTC
    thanks, this tip was nice :)