in reply to Adding <pre> at beginning </pre> at file end

Here is another way

use strict; use warnings; open (FILE,"+<","test"); local $/=undef; my $a=<FILE>; $a =~ s/^(.*)$/<pre>$1<\/pre>/gs; seek(FILE,0,0); print FILE $a;

But you have to be careful when the file size is huge

--Lakshmanan G.

The great pleasure in my life is doing what people say you cannot do.