#!/usr/bin/perl
use strict;
use warnings;
foreach my $file ( @ARGV ) {
print( "Checking $file: " );
if ( -e $file ) {
print( "$file exists!\n" );
if ( -f $file ) {
print( "The file $file is:" );
print( " writable" ) if ( -w $file );
print( "\n" );
}
elsif ( -d $file ) { # is it a directory?
print( "$file is a directory!\n" );
}
}
else {
print( "$file doesn't exist.\n" );
}
print( "\n" );
}
|