HI,
Thanks for the various suggestions, as it turned out I had a blank first line
in the program file and when I removed it the backquotes method worked.I do not
know why this happens?
How can I call a subroutine which is defined in another file i.e. the calling
perlscript and the function are in different files.
Quoting "Shishir K. Singh" <[EMAIL PROTECTED]>:
>
> On Tuesday, July 2, 2002, at 11:23 , drieux wrote:
>
> >> I have a c program which takes two commandline arguments (both
> strings)
> >> and
> >> prints out a line. If I use system then I am not able to grab the
> output
> >> of the
> >> program and if I use backquotes `` then the arguments are also
> treated as
> >> commands and I get an error.
> >> Is there any other way to do this. Ganapathy
> >
> > try
> > -------------------------
> > open(FL, "|$cmd @args");
>
> >isn't that suppose to be
>
> > open(FL, "$cmd @args |");
>
> >so that We can read the stdout of $cmd - vice writing
> >stuff to it????
>
> Damm those pipes...I always get confused between reading and writing!!
> You are correct!!
>
>
> >also isn't it safer to do the
>
> > open(FL, "$cmd @args 2>&1 |") or
> > die "unable to deal with $cmd @args : $!\n";
>
> >so that we get back all of the stdErr from $cmd,
> >and expressly EXPLODE if there is some obvious reason
> >that we can not execute $cmd ???
>
> > while (<FL>){
> > print $_;
> > }
> > close (FL);
> > ------------------------
>
> This was just a test code. The validation and checks can be added by the
> programmer as desired.
>
> >If you want to test stuff without actually having the
> >command you can use uncle drieux's Handy Dandy DoCmd.txt
> >spoofer - cf:
>
> >http://www.wetware.com/drieux/pbl/perlTrick/drieuxTemplates/DoCmd.txt
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]