in reply to Sneeky Snake
#!/usr/bin/perl -w open TEXT, 'country_7.html' || die $!; my $text; while(<TEXT>) { ## lot of ram... chomp; $text .= $_; } $text =~ s/<\/table.*//; my @lines = split /<tr>/im, $text; shift @lines; ## drop trailing html shift @lines; ## ...and <th>.. foreach my $line (@lines) { $line =~ s/<\/tr>//i; $line =~ s/<\/td>//gi; my @values = split /<td[\sa-zA-Z=]*>/im, $line; shift @values; print '|'; foreach my $value (@values) { $value =~ s/<\/a>//; $value =~ s/ //; $value =~ s/<a .+>//; print $value , "|"; } print "\n"; }
|
|---|