develooper Front page | perl.perl6.language | Postings from September 2005

[regex] \&

Thread Next
From:
Ruud H.G. van Tol
Date:
September 26, 2005 12:35
Subject:
[regex] \&
Think about adding \& to the replacement part of a s///.

As in sed, the & means the whole match.


Then one can do

  s/$search/*\&*/go

in stead of

  s/($search)/*\1*/go

and there needs to be no $1 variable set up.

(I assume that using () always makes a $1 available, even if it is not
being used.)

-- 
Grtz, Ruud


Thread Next


Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About