Front page | perl.beginners |
Postings from December 2002
Regex help!!
Thread Next
From:
Johnstone, Colin
Date:
December 1, 2002 22:00
Subject:
Regex help!!
Message ID:
1CE69FABC71E184C8991EBD0B31A9EE25ED9C4@fpfexch1.central.det.win
Hi all,
Im reading in a file line by line and I want to look for the occurence of this string
<!-- response here --> in $line. Is this the right way to do it. If it finds it it is to inser the value of $screenOutput in its place.
if($screenOutput ne ""){
my $responsePage = "";
open(IN, "<$locationResponsePageSkin") or die("Cannot open: $!");
while( my $line = <IN>){
$line ~= s/<!-- response here -->/$screenOutput/;
$responsePage .= $line;
}
close(IN);
print $responsePage;
}
Colin Johnstone
Website Project Officer
Corporate Website Unit
Public Affairs Directorate
ph 9561 8643
Thread Next
-
Regex help!!
by Johnstone, Colin