in reply to What's the deal with apostrophes?
Although / is the default regex delimiter in Perl, you can use different punctuation in that role to avoid "leaning toothpick syndrome":$fileline =~ s/$line.shtml"-->/$line.shtml"-->\n<SCRIPT language="Java +Script" SRC="http:\/\/mygreatwebsite.net\/cgi-bin\/gcountdir\/gcount. +pl?0=$line"> <\/SCRIPT>/
or even, if you want to get fancy:$fileline =~ s#$line.shtml"-->#$line.shtml"-->\n<SCRIPT language="Java +Script" SRC="http://mygreatwebsite.net/cgi-bin/gcountdir/gcount.pl?0= +$line"> </SCRIPT>#
$fileline =~ s[$line.shtml"-->] [$line.shtml"-->\n<SCRIPT language="JavaScript" SRC="htt +p://mygreatwebsite.net/cgi-bin/gcountdir/gcount.pl?0=$line"> </SCRIPT +>]
Edit: 1Just to clarify, I referred to the regex in question as a "travesty" solely to echo the OP's description of the code it came from as "the below travesty". I would not normally consider it nearly bad enough to qualify as such.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: What's the deal with apostrophes?
by tallCoolOne (Initiate) on Jun 09, 2009 at 17:56 UTC | |
by afoken (Chancellor) on Jun 09, 2009 at 19:50 UTC | |
by tallCoolOne (Initiate) on Jun 09, 2009 at 21:02 UTC | |
by dsheroh (Monsignor) on Jun 10, 2009 at 11:36 UTC | |
by tallCoolOne (Initiate) on Jun 10, 2009 at 19:27 UTC | |
by JavaFan (Canon) on Jun 10, 2009 at 09:07 UTC | |
by tallCoolOne (Initiate) on Jun 10, 2009 at 03:33 UTC | |
by dsheroh (Monsignor) on Jun 10, 2009 at 11:26 UTC | |
by tallCoolOne (Initiate) on Jun 10, 2009 at 13:42 UTC |