in reply to how to store values from system command

Please ignore this post if you really really want the output of 'ls',
but if you're doing what I think you're doing, take a step back and check out the documention for the internal Perl ways of doing things.
This will allow you to build a robust, portable, and maintainable application.

reading directories

getting the properties of files

non-Perl: Andy Ford