1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
my $filename = shift @ARGV; die "Missing filename" if not defined $filename; open (my $fh_out, '>', $filename . '.converted') or die "Cant open - $!"; open (my $fh_in, '<', $filename) or die "Cant open - $!"; while (my $line = <$fh_in>) { # ;>text12345</a> <a href= $line =~ s|>([^<]+)</a> <a href=|$1|g; print $fh_out $line or warn "Cant write - $!"; } close $fh_in or die "Cant close - $!"; close $fh_out or die "Cant close - $!";