I remember back in '00 when Paul Sack wrote:
> I'm writing a small program that does nothing really to learn perl. (I
> plan on playing with this filehandle.)
> So far it is this:
>
> #!/usr/bin/perl -w
>
> exec "wget http://weather.yahoo.com/forecast/Austin_TX_US_f.html";
The problem is that exec overwrites the current process with the
command you specify, per unix file semantics.
(aside: the standard unix libc code to run a child process looks
like this:
pid = fork(); /* makes two copies of the current process */
if (pid == 0) {
/* child process */
exec ("/path/to/some/command");
/* If we get here, the exec didn't succeed--since it would
totally destroy this copy of the process */
printf ("Couldn't exec /path/to/some/command\n");
/* use error, errno to print OS message */
} else {
/* parent process */
printf ("Child PID is %d\n", pid);
}
/* continue on in the parent. */
)
As someone else mentioned, you need to use the system() call in
perl or backticks `wget ...`.
> open (WEATHER, "Austin_TX_US_f.html") or die "Can't open file: $!\n";
> print "hello\n";
>
> while ($line = <WEATHER>) {
> # if ($line =~ /$<font size="\+2"/); {
I think you probably mean to write /^<font size="\+2"/ here..
> print "hello";
> print $line."\n";
There will be a \n on the line you read in unless you chomp it.
> # }
> }
Everything else looks fine.. I highly recommend _Learning Perl_
and later on _The Perl Cookbook_ and _Programming Perl_
Programming Perl is the leasty useful as a tutorial, but it is the
definitive reference.
Matt
--
/* Matt Sayler -- [EMAIL PROTECTED] -- (512) 494-7360
DO ABSTAIN FROM INTERCAL */
---------------------------------------------------------------------------
Send administrative requests to [EMAIL PROTECTED]