From: Brian Candler Date: 2010-03-01T23:05:22+09:00 Subject: Re: Easy question about gets Wybo Dekker wrote: > require 'scanf' > def getdate(s) > print s > $stdout.flush > d,m,y = scanf("%d%d%d") > end > > d,m,y = getdate("Your birthday? ") > > p d,m,y Or at a higher level: require 'date' birthday = Date.parse(gets) puts birthday.day, birthday.month, birthday.year Warning: this accepts a lot of formats, including the unambiguous yyyy/mm/dd, but seems to default to American middle-endian dates. irb(main):013:0> birthday = Date.parse("01/02/2003") => # irb(main):014:0> puts birthday.day, birthday.month, birthday.year 2 1 2003 => nil -- Posted via http://www.ruby-forum.com/.