On Thu, May 1, 2008 at 10:00 PM, William James <w_a_x_man / yahoo.com> wrote:
> On May 1, 9:39 pm, Amasa Masiarek <a... / masiarek.com> wrote:
>  > s = <<EOS
>  > a1\t  b1
>  > a2\tb2
>  > EOS
>  >
>  > s.each{|e|
>  >     a = e.strip.split("\t")
>  >     p a[1]
>  >
>  > }
>  >
>  > output:
>  > "  b1"
>  > "b2"
>  >
>  > expected output:
>  > "b1"
>  > "b2"
>  >
>  > What is wrong?
>  > --
>  > Posted viahttp://www.ruby-forum.com/.
>
>
>  "
>
>  a1\t     b1
>  a2\tb2
>
>
>  ".strip.each{|x|
>   a = x.split("\t").map{|s| s.strip }
>   p a.last
>  }
>
>

Or split on whitespace instead of on tabs alone.

s.each{|e|
   a = e.split("\s")
   p a[1]
}