Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: Golf: Fix de facto HTML comments

by Chady (Priest)
on Jul 19, 2004 at 07:33 UTC ( #375471=note: print w/replies, xml ) Need Help??


in reply to Re: Golf: Fix de facto HTML comments
in thread Golf: Fix de facto HTML comments

I was thinking along the same lines too, but I had a different approach to it, which saved me three characters.

46 (but changes too much)
if we lookahead and lookbehind, we can lose the last "<!--$x-->" bit, and if we use $_ we can save 1 character from =~ and lose "my"
s/(?<=<!--)(.+?)(?=-->)/($_=$1);s|-||g;$_/seg

He who asks will be a fool for five minutes, but he who doesn't ask will remain a fool for life.

Chady | http://chady.net/

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://375471]
help
Chatterbox?
[LanX]: it was just after Trump-ageddon and the Americans thought I'm ridiculing them ;)
Discipulus was not the title a bit provoking? ;=)
[LanX]: I have a degree in cynism. ..
LanX is the PROVO-KING
[holli]: what's that smell?
[LanX]: good evening! :)

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2017-11-20 19:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (292 votes). Check out past polls.

    Notices?