is the file a plain file?
#!/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( "It is ", -s $file, " bytes.\n" ); # size
}
elsif ( -d $file ) {
print( "$file is a directory!\n" );
}
}
else {
print( "$file doesn't exist.\n" );
}
print( "\n" );
}
Related examples in the same category