User:TheDJ/getfiles.pl
Jump to navigation
Jump to search
#!/usr/bin/perl use strict; use warnings; use LWP 5.64; use LWP::Simple; # apache file listing open( LISTGPN, "../Desktop/GPNs.html" ); # destination file with one GPN id per line open( NEWGPN, ">gpn.txt" ); my $record; # Read one line from the file while ($record = <LISTGPN>) { # Try to find the GPN-number in this line if( $record =~ m/A\ HREF=\"(\S*?).html\"/i ) { # If found print the number to a new file and add a line-ending. print NEWGPN $1."\n"; } else { print "ERROR for ".$record; } } close(LISTGPN); close(NEWGPN);