Hi
I have 4 files in directory on my desktop?
My question is
1.How can I display for each file only the name, the size and the date in this order?
2. How can I display all files sorted accorded their name?
#!/usr/bin/perl
use strict;
use warnings;
my $dir = 'C:\Users\bt\Desktop\perl_files';
opendir(DIR, $dir) or die $!;
my @files = sort { $a <=> $b } readdir(DIR);
while (my $file = readdir(DIR)) {
# Use a regular expression to ignore files beginning with a period
next if ($file =~ m/^\./);
print "$file\n";
}
closedir(DIR);
exit 0;
But i get error?