in reply to grabbing N lines after matching one?
couldn't seem to edit my last comment....
here is what I have so far (first version to make it past -w):
use strict; use LWP::Simple; use Date::Business; my $content = get("http://quotes.barchart.com/quote.asp?sym=qsft&code= +BGND"); open( FILE, ">stocks.txt" ) or die; print FILE $content; close FILE; my $today = new Date::Business(); my $date = $today->image(); my ($century, $year, $month, $day) = unpack "A2 A2 A2 A2", $date; my $search_date = sprintf "%s/%s/%s", $month, $day, $year; ###testing on a weekend :) $search_date = "09/15/00"; open( STOCK, "stocks.txt" ) or die; my (@lines, $matcher); while ( <STOCK> ) { if ( m/$search_date/ ) { push @lines; if ( $matcher eq "" ) { $matcher = "1"; } else { $matcher++; } } if ( $matcher eq "6" ) { last; } } close STOCK; print "@lines\n\n";
-- I'm a solipsist, and so is everyone else. (think about it)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: RE: grabbing N lines after matching one?
by mdillon (Priest) on Sep 16, 2000 at 21:02 UTC | |
by jptxs (Curate) on Sep 16, 2000 at 21:07 UTC |