Thread: read and edit a file
Results 1 to 1 of 1
Related
-
Any way to download a .cgi file and read the contents? Forum: CGI Perl Forum
Replies: 4 -
Java script: Edit a file loaded from server to client Forum: Javascript Forum
Replies: 0 -
read file Forum: CGI Perl Forum
Replies: 0 -
go to read a text file evry 2 minutes Forum: CGI Perl Forum
Replies: 6
-
01-03-2005, 12:16 AM #1
read and edit a file
i wish to read a file, while file the content match the pattern, then substitute it.Now i only able to match it.
My code:
==============
#!c:/perl/bin/perl
use CGI qw(:standard);
$id="_shop";
open (F,"image.pl") or die $!;
{ local $/; $bfr = <F>;
if($bfr=~m/\#<start$id>([\w\W]*)\#<end$id>/gsi)
{
$m=$1;
s/$m//; #not work
s/\#<start$id>//; #not work
s/\#<end$id>//; #not work
}
}
close F or die $!;
========================
image.pl's content:
=========================
#!c:/perl/bin/perl
use CGI qw(:standard);
#<start_shop>
$name="shop";
$id="111";
#<end_shop>
============
i wish to substitute the whole part of:
#<start_shop>
$name="shop";
$id="111";
#<end_shop>
Cloudjiffy- PaaS for Developers
10-05-2020, 12:30 AM in Web Hosting Forum