Aaron D. Gifford wrote:
> Ruby 1.9: 34 characters
> 
> eval(gets.scan(/(?:^| )(\d+)/)*?+)
> 
> Aaron out

edit:
y=0
s=""
s.scan(/ \d+|^\d+/){|x|y+=x.to_i}
puts y

i put puts y so i can do it in a script file instead of irb and removed 
semicolons as ';' counts as a char,

38 char-w/o puts y
43 chars-with puts y

this is the shortest i have seen w/o getting into an infinite loop :D,ty
-- 
Posted via http://www.ruby-forum.com/.