Hi, I'm back for some advice from you helpful folks. I'm pulling weather data from the web and manipulating it...using airport codes for various weather data, and I use the same subroutine multiple times for various airports. I've had some success passing various airport codes to the other subroutines using functions like lwp::simple, but in this one it's not working. The actual subroutine works by itself when I add the airport identifier and take out the Sub { header. But when I use it as a subroutine and pass an airport identifier into the web address...which should bring up the data for that airport...it returns nothing...no error message either. I'm fairly new to using lwp::useragent, so it may be that I'm using it as a subroutine incorrectly.
Here's the code if you can lend some help...thanks! #!/perl/bin/perl -w use CGI qw(:standard); use CGI::Carp qw(warningsToBrowser fatalsToBrowser); use strict; use DBI; use LWP::Simple; use HTML::TokeParser::Simple; my $SLPdata=(); print header; print start_html("Gradients"); my $SLP = FcstPress("sfo"); print "$SLP"; sub FcstPress { my $url = 'http://68.226.77.253/text/NAM80km/[EMAIL PROTECTED]'; #substitutes passed variable into @_ like ksfo.txt use LWP::UserAgent; my $browser = LWP::UserAgent->new(); my $res = $browser->get($url) or die "Error getting file: $!"; my @lines = split('\n' ,$res->content); #splits on each new line foreach (@lines) { if ($_ =~ m/^ Mean/i) { #finds line with pertinent data my @SLPdata = split(' ',$_); #splits on each whitespace print $SLPdata[5]; } } } print end_html; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/