if ($data_choice eq 'l' || $data_choice eq 'L') { 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: $!"; @data_lines = <$fh>; } else { print "\nNow requesting data from the FCC server; this will take a minute or two, even with a high-speed internet connection...\n"; 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' ); open my $fh, '>', 'stations.dat' or warn "Trouble opening stations.dat to save new FCC data; is hard drive full? Stopped: $!"; flock $fh, LOCK_EX or die "Trouble getting file lock for stations.dat; is it in use by another program? Stopped: $!"; print {$fh} $stations_data; close $fh or warn "Trouble closing file lock for stations.dat"; @data_lines = split /\n/, $stations_data; }