On Feb 6, 2008 8:38 AM,  <[EMAIL PROTECTED]> wrote:
> Hi,
> I have a query of how to call Tomahawk in perl. Tomahawk is a tool
> used in
> Linux for verifying NIPS. I need to get the Tomahawks attribute from
> the user and pass it to tomahawk tool. If anyone has any idea about
> how to call the Tomahawk tool within perl script..kindly reply.
snip

You have several options.  Which one you chose depends on what you want to do:

system* - you just want to run a command
qx//** - you want to run a command and capture the stdout
IPC::Open3*** - you want to run a command, feed it data on its stdin
and capture its stdout and stderr

You use them roughly like this

##system
system "command" == 0
    or die "command failed";

##qx//
my $all_output = qx{command};
or
my @output_split_by_line = qx{command};

##IPC::Open3
use IPC::Open3;

open3 my $in, $my $out, my $err, "command"
    or die "could not run command: $!";

while (<$out>) {
    #work with lines from $out
}


* http://perldoc.perl.org/functions/system.html
** http://perldoc.perl.org/perlop.html#qx/STRING/
*** http://perldoc.perl.org/IPC/Open3.html

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to