can I save list of files in memory and not in text file?

Hello all
im using allot with the method of getting file list from misc place in unix and copy them into text file
and then doing misc action on this list of files using
foreach f (`cat file_list.txt`)
do something with $f
end
can I replace this file_list.txt with some place in memory?
so I wont need to create files all the time?

There are many ways to do that job:

For ex , you can use an array var.
To fill the array:

i=0
ls|while read file
do
   arr=$file
   (( i += 1 ))
done

To show it:

a=0
while [ a -le i ]
do
echo ${arr[$a]}
(( a += 1 ))
done

Bye