Click to See Complete Forum and Search --> : simple question about s/


afmook
10-20-2005, 04:19 AM
$z =~ s/<!-- process login_status -->/<a href=\"\/cgi-bin\/logout.cgi\">Logout</a>/gi";


is causing


syntax error at basic.cgi line 50, near "s/<!-- process errors -->/<a href=\"\/cgi-bin\/logout.cgi\">Logout</a"


Can't figure out why. I tried it without escaping the /'s as well, no luck.

Ultimater
10-20-2005, 08:29 AM
Forgot one <\/a>. Also get rid of the double quote preceding your semicolon.

Charles
10-20-2005, 09:36 AM
But since this is Perl we can avoid the toothpicking:
$z =~ s|<!-- process login_status -->|<a href="/cgi-bin/logout.cgi">Logout</a>|gi;

Ultimater
10-20-2005, 10:18 AM
Toothpicking? :D Interesting term to use, I like it.

afmook
10-20-2005, 11:41 AM
I appreciate all the help guys. I changed my format slightly, but going to incorporate this into it. Thx.