but maybe you guys(hope this is the correct way :-/) know how to help
me...
I have this simple script:
$/ = "</tu>";
my $header = <>;
# <header/> -> <header></header>
$header =~ s!<header([^/>]+)/>!<header$1></header>!;
# <body version...> -> <body>
$header =~ s!<body[^>]+>!<body>!;
# tmx version -> <tmx version="1.1">
$header =~ s!<tmx version[^>]+>!<tmx version="1.1">!;
# srclang -> srclang="foo"
if ($header =~ m!(xml:)?lang=(["'])([^"']+)\2!) {
$lang = $3;
$header =~ s!srclang=(["'])[^"']+\1!srclang="$lang"!;
}
$header =~ s/xml:lang/lang/g;
# xml:lang -> lang
print $header;
while(<>) {
s/xml:lang/lang/g;
print
}
Basically, a filter working on chunks (about 300bytes chunks).
The problem is that I cannot process a 400MB file, because of
out-of-memory.
What is wrong? how can I solve it?
Thanks a lot, and sorry for being a little OT.
Alberto