"be consistent" | |
PerlMonks |
Representing a 32-bit integerby blankdon (Initiate) |
on May 22, 2007 at 19:43 UTC ( [id://616850]=perlquestion: print w/replies, xml ) | Need Help?? |
blankdon has asked for the wisdom of the Perl Monks concerning the following question:
The problem is: A function is to take a string containing an IP address, such as "192.168.11.5 <http://192.168.11.5/> ". Once it verifies that there's an IP address in the string, the function must produce and return a 32-bit integer representation.
The only way I know to get the representation is to use pack after replacing the '.'s with some numeric value like '0' i.e
This returns 4294967295.
Edit: g0n - code tags and formatting
Back to
Seekers of Perl Wisdom
|
|