On 24/10/2006, at 4:02 AM, Li Chen wrote:

> I come out with  my own solution by using a regxp:
>
> a=[1,2,'','']
> a.delete_if {|x| x=~/$/}
> p  a

Your solution is broken. It'll delete any string from the array:

irb(main):001:0> a = [1, 2, 'a', 'b']
=> [1, 2, "a", "b"]
irb(main):002:0> a.delete_if {|x| x =~ /$/}
=> [1, 2]


Pete Yandell
http://notahat.com/