W
Will
Hi,
I have a longer program that finds and recursively replaces text in
many html files that works beautifully for most cases, but I think I'm
getting hung up on a s/// and regular expressions glitch. I wrote a
very short program that gets to the heart of the matter...
################################################################################
use strict;
use warnings;
my
$find="https://sinaicentral.mssm.edu/intranet/intranet/ct_public/view?trial_id=MSM03204&searchNow=no";
my $replace="http://www.excite.com";
my $thisPage=
"https://sinaicentral.mssm.edu/intranet/intranet/ct_public/view?trial_id=MSM03204&searchNow=no";
$thisPage =~ s#$find#$replace#g;
print $thisPage;
################################################################################
To my understanding, this program should take the long string in $find
and then replace it with $replace and the output should be
"http://www.excite.com". I think the "?" in the $find variable is
being treated as a Regular Expression but I can't figure out a way to
nullify that effect. I'm a librarian not a programmer! Sombody please
help! I'm working for a worthy non-profit that is strapped for cash, so
I have to figure this out! It will bring you good karma! Thanks a
bunch!
Will Jiang
I have a longer program that finds and recursively replaces text in
many html files that works beautifully for most cases, but I think I'm
getting hung up on a s/// and regular expressions glitch. I wrote a
very short program that gets to the heart of the matter...
################################################################################
use strict;
use warnings;
my
$find="https://sinaicentral.mssm.edu/intranet/intranet/ct_public/view?trial_id=MSM03204&searchNow=no";
my $replace="http://www.excite.com";
my $thisPage=
"https://sinaicentral.mssm.edu/intranet/intranet/ct_public/view?trial_id=MSM03204&searchNow=no";
$thisPage =~ s#$find#$replace#g;
print $thisPage;
################################################################################
To my understanding, this program should take the long string in $find
and then replace it with $replace and the output should be
"http://www.excite.com". I think the "?" in the $find variable is
being treated as a Regular Expression but I can't figure out a way to
nullify that effect. I'm a librarian not a programmer! Sombody please
help! I'm working for a worthy non-profit that is strapped for cash, so
I have to figure this out! It will bring you good karma! Thanks a
bunch!
Will Jiang