On Nov 1, 11:17 pm, [EMAIL PROTECTED] (Rob Dixon) wrote:
> Also the call to system() won't write anything to the file you've
> opened as it's executed in a separate process: you need to capture the
> output from host and print it from within the Perl program.
False. Child processes inherit their
On Nov 1, 10:49 pm, [EMAIL PROTECTED] (Phillip Gonzalez)
wrote:
> I'm trying to print stdout to a file, then switch back to the default
> standard out so that it prints to the screen. This script takes a
> list of ip's and does a reverse lookup on them, it then saves the
> output to "reverse.
On Thursday 01 November 2007 20:05, yitzle wrote:
>
> 1) You can use the backticks (``) or qx// quoting to capture the
> output which you can then write to a file
1.5) Use piped open:
open PIPE, '-|', 'host', '-W', '1', $ip or die "Cannot open pipe from
'host' $!";
> 2) Use the Perl select com
Actually,
Yes, it does work. I used it today at work to convert about 800
private ip's to their hostnames.
Just have to make sure that your file containing ip's is in the same
directory as the perl program.
I'm very new to perl and was amazed myself that it actually worked! LoL.
Thanks
Phillip Gonzalez wrote:
Hi,
I'm trying to print stdout to a file, then switch back to the default
standard out so that it prints to the screen. This script takes a list
of ip's and does a reverse lookup on them, it then saves the output to
"reverse.txt".
Here's my code:
#!/usr/bin/perl
u
1) You can use the backticks (``) or qx// quoting to capture the
output which you can then write to a file
2) Use the Perl select command. From the Perldoc:
select FILEHANDLE
... a write or a print without a filehandle will default to this FILEHANDLE
3) Use the shell's own redirection. See
http:/