From: Alex Shulgin Date: 2008-02-21T04:50:05+09:00 Subject: Re: IP Address to Decimal - is an one-liner possible? On Feb 20, 3:38 am, Tiago Pinto wrote: > > What do you think? There's a way to do this? Is this just a silly question? > > I know, we should be working, but we both love Ruby. Everybody replied already, still I think left-shift deserves mentioning: "127.0.0.1".split('.').inject(0) { |s,x| (s << 8) + x.to_i } => 2130706433 -- Cheers, Alex