#!/usr/bin/perl my $data; open(DATF, "pt.dat") || die "Could not read datfile: $!\n"; {local $/;$_ = ;} close(DATF); my $in_record; # Now we're gonna chop out all the extra HTML and stuff we don't need tr/\n//d; #$data =~ s/<[^>]+>/:/g; s/\Q\E//g; # You might need to tinker w/ whitespace here s/\Q\E//g; s/<\/?table[^>]*>//g; s/\Q \E//g; s/<\/?tr>//g; s/]+>//g; s/<\/a>//g; s/
//g; s/<\/td>//g; # And now we'll parse it. my $in_record=-1; # So $in_record will hit zero on the 1st loop while($_) # While we haven't eaten it all { s/^\s*//; # Remove heading whitespace if(s/^<\/?td>//){next;} # Remove heading comments # print "D: $_\n"; if(s/^Signed on:(\w+ \d+, \d+)//) { # Begins an entry $in_record++; $record_date[$in_record] = $1; next; } if(s/^Name:([^<]+)//) {$record_name[$in_record] = $1; next;} if(s/^Email: ([^<]*)//) {$record_email[$in_record] = $1;next;} if(s/^Country:([^<]*)//) {$record_country[$in_record] = $1;next;} if(s/State\/Province\/Territory:([^<]*)//) {$record_place[$in_record] = $1;next;} if(s/City:([^<]*)//) {$record_city[$in_record] = $1;next;} if(s/Site rating:([^<]*)//) {$record_rating[$in_record] = $1;next;} if(s/Comments:([^<]*)//) {$record_comments[$in_record] = $1;next;} if(s/(\w):[^<]*//) { print "Add a new handler to remove or parse leading elements of this: $1\n";next;} }