Re: simple golf for fun

[email protected] (Ton Hospel) Tue, 16 Jan 2007 18:47:11 +0000 (UTC)
Newsgroups gmane.comp.lang.perl.golf
Organization lunix confusion services
Message-ID <[email protected]>
In article <[email protected]>,
	Phil Carmody <[email protected]> writes:
> This is a real world task which can be solved in a couple of lines. 
> Which makes me think that you guys can do it in about half a line!
> 
> The simple version of the task is to verify that each line of a file is the
> insertion of one character somewhere (maybe at the start or the end) into the
> prior line.
> 
> So
> <<<
> 1
> 12
> 132
> x132
>>>>
> would be accepted, but
> <<<
> 1
> 12
> 132
> alien132
>>>>
> would not be accepted.

Regex is always nice:
-p0 $_ x=/^((.*)(.*)
(?=\2.\3
|$))*$/