# 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)