Question: How to execute a program and read results 
Author Message
 Question: How to execute a program and read results

This may seem extremely easy and straightforward, and is probably documented
in a number of perl books I have (in PA), but I'm in NE and all I have is the
2nd edition camel book and the solution has escaped me.

What I'd like to do is something that should be fairly easy. For example,
execute the command "/usr/bin/finger username" and I want to be able to get
the output of that command.

Can someone help me out here?  Thanks

Greg



Fri, 14 Jan 2000 03:00:00 GMT  
 Question: How to execute a program and read results

Quote:

> This may seem extremely easy and straightforward, and is probably documented
> in a number of perl books I have (in PA), but I'm in NE and all I have is the
> 2nd edition camel book and the solution has escaped me.

> What I'd like to do is something that should be fairly easy. For example,
> execute the command "/usr/bin/finger username" and I want to be able to get
> the output of that command.

$value = `/usr/bin/finger username`;
open(F,"/usr/bin/finger username|");
$value = join('',<F>);
close F;
etc, etc, etc.

                        -AJS



Fri, 14 Jan 2000 03:00:00 GMT  
 Question: How to execute a program and read results

well you obviously have net access, and your question is rediculously
well documented with at least 3 different methods of solving it, so...

RTFFAQ:

ftp://ftp.digital.com/pub/plan/perl/CPAN/doc/manual/html/pod/perlfaq8...

Quote:

> This may seem extremely easy and straightforward, and is probably
> documented
> in a number of perl books I have (in PA), but I'm in NE and all I have
> is the
> 2nd edition camel book and the solution has escaped me.

> What I'd like to do is something that should be fairly easy. For
> example,
> execute the command "/usr/bin/finger username" and I want to be able
> to get
> the output of that command.

> Can someone help me out here?  Thanks

> Greg

--
_______________________________________________________________

Rick Mangi                                  Tel: (212) 972-2030
Thaumaturgix, Inc.                          Fax: (212) 972-2003

New York, NY 10017                          http://www.tgix.com
          thau'ma-tur-gy, n. the working of miracles
  "Perl is a state of mind as much as it is a language grammar"
_______________________________________________________________



Fri, 14 Jan 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Executing Programs, and grabbing the results

2. how do i execute a .pl program from within a .pl program

3. Urgent - Executing a Perl program from another perl program

4. how do i execute a .pl program from within a .pl program

5. executing PHP script from perl script, parse results

6. How do I spawn an xterm executing another program and then interact with the executed program with Expect.pm

7. How do I spawn an xterm executing another program and then interact with the executed program with Expect.pm

8. reading headers? results from a called script

9. How can I evaluate a result on the STDOUT of an C-Program on WinNT

10. Form results work but (read on)

11. passing the results of a command back to a perl program

12. Why do these two programs give different results?

 

 
Powered by phpBB® Forum Software