manishrathi has asked for the wisdom of the Perl Monks concerning the following question:
This code does not give any error nor does it print outputopendir (dir, "C:\Users\Admin\Desktop\Staples files"); @dir_content = readdir(dir); closedir(dir); for $d(@dir_content){ print "$d "; }
I am getting following errors when I run this codeopendir dir, "C:\Users\Admin\Desktop\Staples files\"; my @files = readdir(dir); closedir(dir); foreach $file(@files){ print "$file \n"; } print $#files ;
This code does not give anu errors. but does not print content of files either.open file, "< C:\Users\Admin\Desktop\staples\readfile.txt"; @file_content = <file>; for $f (@file_content){ print "$f \n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Reading DIR content and printing it
by Corion (Patriarch) on Jul 17, 2011 at 10:35 UTC | |
by manishrathi (Beadle) on Jul 17, 2011 at 10:59 UTC | |
by Corion (Patriarch) on Jul 17, 2011 at 11:36 UTC | |
by happy.barney (Friar) on Jul 17, 2011 at 11:20 UTC | |
|
Re: Reading DIR content and printing it
by Khen1950fx (Canon) on Jul 17, 2011 at 14:13 UTC | |
|
Re: Reading DIR content and printing it
by perlaintdead (Scribe) on Jul 18, 2011 at 05:45 UTC |