perl - How to store the output of wget into a variable -
with backticks, system call displays wget data screen.
what have information wget "piped" string or array rather screen.
below snippet of code.
sub wgetfunct { $page = `wget -o - "$wgetval"`; while ( <input> ) { #line line operations } }
you can run os command (i referring linux only) , capture output/error returned command below:
open (cmdout,"wget some_thing 2>&1 |"); while (my $line = <cmdout>) { ### each line of hte command output/eror; }
edit after reading op's comment:
any way not have wget information print stdout?
below code download file without posting screen:
#!/usr/bin/perl -w use strict; open (cmdout,"wget ftp://ftp.redhat.com/pub/redhat/jpp/6.0.0/en/source/md5sum 2>&1 |"); while (my $line = <cmdout>) { ; }
refer perlipc more information.
Comments
Post a Comment