$testfile = '/mnt/homes/CLASSES/CIS2279/LAB03/test.jpg';
chomp($ARGV[$#ARGV]);
if ($#ARGV >= 1) {
print "We have the correct number of arguments.\n";
}else{
print "You are missing some arguments. Exiting...\n";
exit;
}
if(( $ARGV[1] =~ /\d/) && ($ARGV[1] !~ /\D/)) {
print "Yes, we have a number for the second argument.\n";
}else{
print "Second argument is not a real number. Exiting.\n";
exit;
}
if ($ARGV[0] =~ /^temp/i) {
if(($ARGV[1] <= 140) && ($ARGV[1] >= -40)) {
print "Temperature is okay.\n";
}else{
print "Bad value for temperature.\n";
}
}elsif ($ARGV[0] =~ /^rh/i) {
if(($ARGV[1] <= 100) && ($ARGV[1] >= 0)) {
print "RH: ok\n";
}else{
print "rh: loser\n";
}
}else{
print "weirdness...\n";
}
if( -d $testfile) {
print "$testfile is a directory.\n";
}elsif( -f $testfile) {
print "$testfile is a file.\n";
}else{
print "I have no idea what this thing is.\n";
}
if( -r $testfile ) {
print "We can read $testfile\n";
}else{
print "$testfile is not readable.\n";
}
if( -w $testfile ) {
print "We can write to $testfile\n";
}else{
print "$testfile is not writeable.\n";
}
exit;