From: ozawa@... Date: 1998-12-17T14:16:05+09:00 Subject: [ruby-talk:00116] RE: STDIN integer assignment In article , Julian Fondren writes: > in the following script, how would I be able to have the input along the > lines of ``10 100 '' assign ans1 to 10 and ans2 to 100? Use regular expressions. -----^ input = STDIN.gets.chomp /(\d+)\s+(\d+)/ =~ input ans1 = $1.to_i ans2 = $2.to_i -----$ More obfuscating way:-p -----^ ans1, ans2 = STDIN.gets.chomp.scan(/\d+/).collect { |x| x.to_i } -----$ -- OZAWA -Crouton- Sakuro, A.I.Soft Inc. Office: Private: "The world is full of fascinating problems waiting to be solved." -esr