#!/usr/bin/perl -w

# Change the current working dir to /tmp
chdir("/tmp") || die "Weird.  There is no /tmp";

# Get a list of every file in the current directory
@files = glob("*");
push @files, glob(".*");

# print the files
print "Here are all the files:\n";
print @files;

#print the files with a \n after each name
print "Here are the files printed nicely\n";
@nicefiles = map { $_ . "\n" } @files;
print @nicefiles;

for $file (@files) {
	if ($file eq "..")  { 
		print "Parent dir\n";
	}
	elsif ($file eq ".") {
		print "This dir\n";
	}
	elsif (-d $file) {
		print "Dir $file\n";
	}
	elsif (-f $file) {
		($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
                $atime,$mtime,$ctime,$blksize,$blocks) = stat($file);     
		print "File $file size $size\n";
	}
}


