1748063 Members
5301 Online
108758 Solutions
New Discussion

Re: add checking

 
2ne1Abcd
Occasional Contributor

add checking

deleted

2 REPLIES 2
RJHall
Frequent Advisor

Re: add checking

One way to check the output of a system command is to run it in a Perl 'open' operation and filter on the output. For example:

 

my $fh;

my $cmd = "ls -1 /tmp";

if ( open( $fh, "$cmd |" ) ) {

  while( $fh ) {

    my $line = $_;

    # Process the $line content here...

  }

 

  close( $fh);

}

 

There's plenty of examples of this sort of operation on the web. But I'd suggest learning a little more about perl before you proceed.

RJHall
Frequent Advisor

Re: add checking

I'm having some difficulty understanding you. What do you mean by "the UNIX command"? Do you want to pass an arbitrary command to the subroutine and have it executed?