Turning number ranges into prefixes

David Cantrell david at cantrell.org.uk
Wed Aug 23 18:04:02 BST 2006


On Wed, Aug 23, 2006 at 05:21:31PM +0100, Simon Cozens wrote:
> David Cantrell:
> > $ perl -e 'print "1424210000" ^ "1424225999"'
> > [some whitespace]
> 
> Sorry, there was some magic I was missing; I half-remembered this hack, which
> I think is either due to Nicholas or Damian. Given 
>     ($a ^ $b) =~ /^(\0+)/,
> the common prefix between $a and $b is ...

14242, but that is also the prefix for 1424277777, which is outside the
range.

-- 
David Cantrell | A machine for turning tea into grumpiness

      Googling for "Swedish lizard overlord" gives
      this sig as the first result.
      
      WHAT DOES THAT TELL YOU, EH? EH?


More information about the london.pm mailing list