Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Adding <pre> at beginning </pre> at file end

by lakshmananindia (Chaplain)
on Apr 08, 2009 at 04:25 UTC ( [id://756222]=note: print w/replies, xml ) Need Help??


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.


Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://756222]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2024-04-23 16:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found