thank you for your reply. I tried your code and it WORKS! thank you very much and thanks for every one who had replied my questions.
by the way, I would like to do some operation to the file, I tried some code like this:
print "hello 1\n" if (-r $_);
my @matching = grep {/$my_pattern/} <$_>;
I failed with this code. I have to
open $filehandle,"<", $_" or die ....
my @matching = grep {/$my_pattern/} <$_>;
did I do something wrong? or is there any better way to do grep or similar operateion in the $_? thanks.