Mega Code Archive

 
Categories / Perl / File
 

Contents of the current directory

#!/usr/bin/perl use strict; print "Contents of the current directory:\n"; foreach (<*>) {     next if $_ eq "." or $_ eq "..";     print $_, " " x (30 - length($_));     print "d" if -d $_;     print "r" if -r _;     print "w" if -w _;     print "x" if -x _;     print "o" if -o _;     print "\t";     print -s _ if -r _ and -f _;     print "\n"; }