New to Perl, hope someone could kindly explain the following questions related to this code:
$url ="some url";
open FH, "wget -q -O- $url|" or die;
while(<FH>){
...
}
-
in -O-
mean?|
in $url |
mean? $url ="some url";
open FH, "wget -q -O- $url|" or die;
seek(FH, 14000, 1);
but if I echo the position with echo tell(FH)
, I get 0, anyone know why couldn't I seek the FH? Thanks
The -O-
argument tells wget
to output to standard output (i.e. your console/terminal), not to a file.
The pipe in the open call is a pipe open. The file handle will be connected to the process's output (in this case, to what wget
outputs).
A tell
call on this type of filehandle doesn't really make sens. The underlying thing is a stream, not a file. tell
can return different things on streams, it depends on the OS.