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>){
...
}
- what does the the second
-in-O-mean? - what does the
|in$url |mean? - I tried to do a seek with the FH like this:
$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 tellswgetto 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
wgetoutputs).A
tellcall on this type of filehandle doesn't really make sens. The underlying thing is a stream, not a file.tellcan return different things on streams, it depends on the OS.