#!/usr/bin/env ruby def a i = 0 while line = STDIN.gets yield i, line i += 1 end end a { |i,j| puts "#{i} #{j}" }