in reply to writing the finding result into a file.txt

The $s contains the return value of the find, not what you found. If you let the sub edit do the writeout, I think it will do what you expect.
Also use strict :).
  • Comment on Re: writing the finding result into a file.txt