[Omaha.pm] Perl-golf -- zero-pad an IP address.

Daniel Linder dan at linder.org
Sun Jan 30 20:46:46 PST 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

<quote who="Jay Hannah">
> sub zeropad {
>     return sprintf("%03d.%03d.%03d.%03d", split /\./, $_[0]);
> }

And that is just why I love Perl -- compactness when needed, or
verboseness when warranted...

Dan

- - - - -
"I do not fear computer,
I fear the lack of them."
 -- Isaac Asimov
GPG fingerprint:9EE8 ABAE 10D3 0B55 C536  E17A 3620 4DCA A533 19BF

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFB/bg1NiBNyqUzGb8RAnPLAJ9PGIhzCOfsGHlqWHNmFv01dtf7gACfUXZa
uIRfzHuzbxLnDdWcQPUcA4A=
=mSxz
-----END PGP SIGNATURE-----


More information about the Omaha-pm mailing list