From: matz@... (Yukihiro Matsumoto) Date: 2002-07-27T03:47:15+09:00 Subject: Re: Some basic Ruby questions Hi, In message "Some basic Ruby questions" on 02/07/27, Benjamin Sommerfeld writes: |def pictureMethod | executeNativeCommand("ls | grep \"jpg\" > pictures.txt") | pictureFile = File.open("pictures.txt","r") | while(pictureFile.hasMoreLines) | array.attach(pictureFile.actualLine) | pictureFile.goOneLineDown | end |end Like this? def pictureMethod array = [] system("ls | grep \"jpg\" > pictures.txt") pictureFile = open("pictures.txt","r") while (line = pictureFile.gets) array.push(line) end array end Or even def pictureMethod system("ls | grep \"jpg\" > pictures.txt") File.readlines("pictures.txt") end If you don't need to leave the file def pictureMethod open("|ls | grep \"jpg\"").readlines end |I don't know the Ruby syntax that's why I wrote it in kind of "spoken code":-) It was close. matz.