Yep, another newbie at Perl. I have come to a wall. What I need to do is
open a file, find a value in the file and substitute a value.
I've gotten to the point of what to do with an open file. I have been trying
the @array = <testfile> statement.
I then wanted to verify the contents of the array and tried printing it,
print("$array\n");
But there is no output is unexpected! 0: is the output.
Also, the substitute thingie is, well, odd. Say, I define $sFind="this.gif",
and $sSwap="that.gif".
And say I have an array with each line of a file tucked away in it. What the
heck is the syntax for it????
#\perl\bin
open(TESTFILE, ">>/Inetpub/wwwroot/date.htm") || die "Can't open
/Inetpub/wwwroot/date.htm: $!";
@array = <TESTFILE>;
print ("$array\n");
$sFindGIF = "this.gif";
$sSwapGIF = "that.gif";
for ($index = 0; $index<=$#index; $index++) {
if ($array[$index] =~ /sFindGIF/) {
last;
}
}
print ("$index: $_\n");
$s = $array[$index];
$s =~ s/this.gif/that.gif/;
close (TESTFILE);
Please, any pointers, thanks.