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