[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] longest substring with unique characters



On Jan 19, abigail@foad.org said:

>#!/opt/perl/bin/perl -w
> 
>use strict;
> 
>my $max = 0; $_ = shift;
>while (/\G(.)(?=((?:(?!\1).)*))/g) {$max = $1.$2 if length $max < length $1.$2}
>print $max, "\n";

This is also errant.  Try it with "this isn't right".

-- 
Jeff "japhy" Pinyan     japhy@pobox.com    http://www.pobox.com/~japhy/
CPAN - #1 Perl Resource  (my id:  PINYAN)       http://search.cpan.org/
PerlMonks - An Online Perl Community          http://www.perlmonks.com/
The Perl Archive - Articles, Forums, etc.   http://www.perlarchive.com/


==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe