develooper Front page | perl.fwp | Postings from March 2002

Re: TPR1 post-mortem

Thread Previous | Thread Next
Adam Spiers
March 8, 2002 08:27
Re: TPR1 post-mortem
Message ID:
Philippe 'BooK' Bruhat ( wrote:
> What you want is:
>     s/(?!^).(?!$)/$&$&/g
> Now, can we shorten it?
>     s/\B.(?=\B)/$&$&/g

Except that that tickles the bug discussed elsewhere in this thread,
and is hence no use.

$ echo 1234 | perl5.6.1 -lpe 's/\B.(?=\B)/$&$&/g'

> Anything better?

Yep :-)


Produces all but the penultimate pair in reverse order, which is of
course OK, because the function is symmetrical.  I didn't end up using
it though, and noone else did either, it seems.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About