Cool idea!

The data file is many megs in size; it basically covers anything you might hear on the AM band at night, not just the U.S. and Canada. So it took about a minute for it to download to my local installation.

I like the idea of downloading the current data, in order to have the most recent information... your link worked great!

I was actually able to revise the script in only about 15 minutes' time... maybe I'm starting to know what I'm doing! Thanks for the opportunity to stretch my programming legs.

Here are the only changes I needed to make:

# old # use Fcntl qw( :flock ); # new use LWP::Simple; # old # open my $fh, '<', 'stations.dat' # or die "Trouble opening stations.dat; is it in same directory as + stations.exe? Stopped: $!"; # flock $fh, LOCK_SH # or die "Trouble getting file lock for stations.dat; is it in use + by another program? Stopped: $!"; # # while (my $line =~ <$fh>) { # new my $stations_data = get( 'http://www.fcc.gov/fcc-bin/amq?state=&call=& +arn=&city=&freq=530&fre2=1700&type=0&facid=&class=&list=4&dist=&dlat2 +=&mlat2=&slat2=&NS=N&dlon2=&mlon2=&slon2=&EW=W&size=9' ); my @data_lines = split /\n/, $stations_data; LINE: foreach my $line (@data_lines) { next LINE unless ($line =~ /\|/); # old (later in the script) # close $fh; # new (delete that line)

---

THANKS again! Maybe I'll give a try at storing the data I've collected through LWP::Simple.

Dave


In reply to Re^4: AM Radio Station Finder by davebaker
in thread AM Radio Station Finder by davebaker

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.