programming-examples/perl/File/Prints the size of a file in bytes.pl
2019-11-15 12:59:38 +01:00

11 lines
284 B
Perl

#!/usr/local/bin/perl
print ("Enter the name of the file:\n");
$filename = <STDIN>;
chop ($filename);
if (!(-e $filename)) {
print ("File $filename does not exist.\n");
} else {
$size = -s $filename;
print ("File $filename contains $size bytes.\n");
}