Re: AW: mini-golf: first differing position

Xavier Noria <[email protected]>
Newsgroups gmane.comp.lang.perl.fun
Message-ID <[email protected]>
On Apr 21, 2004, at 10:04, Yitzchak Scott-Thoennes wrote:

> On Wed, Apr 21, 2004 at 09:44:54AM +0200, Xavier Noria <[email protected]> 
> wrote:
>> Good. With a little modification we get 26 if this is right:
>>
>>     $_=$x^$y;$n=$-[0]if/[^\0]/
>
> $x = "abc"; $y = "abc\0\0\0"; gives undef instead of the required 3
>
> On Wed, Apr 21, 2004 at 07:48:57AM +0200, Xavier Noria <[email protected]> 
> wrote:
>>
>>     {$x ne$y&&$x=~/./sg&$y=~/\G$&/g&&redo;$n=$-[0]}
>
> Needs a \Q after the \G. (Consider $x = "a.c" and $y = "abcdef" or
> $x = "a+c" and $y = "a+cd".)

Sure thank you, then looks like

     {$x ne$y&&$x=~/./sg&$y=~/\G\Q$&/g&&redo;$n=$-[0]}

is the shortest solution so far (49).

-- fxn
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.