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

Re: [FWP] IP address regex golf



On Apr 29, Rick Delaney said:

>> >>    4==grep $_<256,/\G(\d+)(?:\.|\z)/g;
>> 
>> That doesn't work.  "1.2.3.100000.4".

>> 
>>       1x4==join"",map$_<256,/\G(\d+)(?:\.|\z)/g;
>
>Is that supposed to work or is it merely demonstrating what's wrong with
>mine?  To work that needs to be something like
>
>    1010101==join 0,map$_<256,/\G(\d+)(?:\.|\z)/g;

Mine (the 1x4 one) works.  1x4 is no different from 1010101 if you join on
"" instead of 0.

-- 
MIDN 4/C PINYAN, NROTCURPI, US Naval Reserve             japhy@pobox.com
http://www.pobox.com/~japhy/                  http://pinyaj.stu.rpi.edu/
PerlMonth - An Online Perl Magazine            http://www.perlmonth.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