On Wed, Mar 12, 2008 at 12:34 AM, Ma Fe <frytaz / gmail.com> wrote: > well I dont know where in array i have .txt files but its sure that > there is just one and i want to put it at first place of array... > -- > Try using the #partition method (my last example) then. It gives you all .txt files at the beginning of the array. I made a mistake though. There should only be one dot, not two for that (same thing if you use #select)... a = ['one.jpg', 'two.txt', 'three.pdf', 'four.txt'] a_new = a.partition {|i| i =~ /\.txt$/} p a_new Todd