on Fri, 31 May 2002 01:57:19 GMT, [EMAIL PROTECTED] (Alan C.)
wrote: 

> my $output = qx(graburl 
> http://www.wrh.noaa.gov/cgi-bin/Sacramento/afd?SFOZFPSTO);
> open MYWTHR, ">myweathr"
>     or die "Cannot create mywthr_txt: $!";
> print MYWTHR "$output";
> #----end--
> But it pulls all content, including the html, from that url and
> writes to file. 
> 
> Can strip all html before writes to file?  If so, how?

I don't want/need graburl.exe - used LWP::Simple instead (no need to 
fork).

A quick look at the source of the html revealed that anything of 
interest is after a "<pre>" tag. (Incidentally, there was no 
"</pre>").

So the following code should grab the text only:

    #! /usr/bin/perl -w
    use strict;
    use LWP::Simple;

    my $output = get(
       "http://www.wrh.noaa.gov/cgi-bin/Sacramento/afd?SFOZFPSTO";);
    $output =~ s/(.*)<pre>//s; # the s-modifier is essential!
    print $output;

You could fit the line with the regex in your program and it should 
work.

-- 
felix

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to