http://qs321.pair.com?node_id=570117

samirpatry has asked for the wisdom of the Perl Monks concerning the following question:


To read the files present in the given folder i write this program.
use warnings; use strict; my ($listitem,$dir); $dir="C:/Temp"; opendir(DIR, $dir) or die "Can't open $dir: $!"; my @contents = grep !/^\.\.?$/, readdir DIR; foreach $listitem ( @contents ) { print "$listitem\n"; }

It will work fine .but when i use the <STDIN> and give the option to enter the folder name or path to the specified folder then it will not work.Plz help me where i lack somthing