MKevin has asked for the wisdom of the Perl Monks concerning the following question:
Now how do i make the program skip to the next line and conduct the rest of itself when $LEV = 0#!/usr/bin/perl -w # ## Copyright (c) 2007 # my $pkgdoc = <<'EOD'; #/**------------------------------------------------------------------ +-------------- # @ file radiosondeparcer.pl # This scirpt parces the fetched radiosonde data from # the plymoth website. # # @project Kat # @ussage radiosondeparcer.pl ddd.hh.yyyy.index.txt # date: Jan 18, 2007 #--------------------------------------------------------------------- +-------------*/ EOD # $Log$ use strict; use warnings; use Getopt::Long; if (@ARGV <1) { print $pkgdoc; exit -1; } my $txtfile = shift; my $lat; my $long; open (DATA, $txtfile)||die "cannot open $txtfile for reading"; # First seek location line while (<DATA>) { next unless /(-?\d+(?:\.\d*)?)\s+ (-?\d+(?:\.\d*)?)\s+ \d+\s \d+/ +x; ($lat, $long) = ($1, $2); last; } # print "$lat, $long\n"; # Skip to data lines while (<DATA>) {last if /^-+$/}; while (<DATA>) {last if /^-+$/}; open (OUT, ">$txtfile.redo"); # Skip to data lines to get scf data while (<DATA>) { my ($LEV, $PRES, $HGHT, $TEMP, $DEWP, $RH, $DD, $WETB, $DIR, $SP +D, $THETA, $THEV, $THEW) = split ' '; next DATA if ($LEV =~ /0/); if ($LEV && $LEV =~ /SFC/) { last unless defined $SPD; print OUT "$lat $long $PRES $HGHT $TEMP $DEWP $D +IR $SPD\n"; } if ($PRES && $PRES =~ /850|500|250/) { last unless defined $SPD; print OUT "$lat $long $PRES $HGHT $TEMP $DEWP $D +IR $SPD\n"; } last unless defined $THEW; } close (DATA); close (OUT);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Trying to skip for $LEV = 0
by dorko (Prior) on Jan 28, 2007 at 07:01 UTC | |
|
Re: Trying to skip for $LEV = 0
by virtualsue (Vicar) on Jan 28, 2007 at 11:28 UTC |