use strict; use warnings; my $ref_file = $ARGV[0]; if (isReadableFile ($ref_file)) { executeComm ("cat $ref_file"); } else { print STDERR "$ref_file Does not exist\n"; } ## In a different module... sub isReadableFile { my $file = shift; if (defined ($file) && # was a file name passed? ((-f $file) || (-l $file)) && # is the file a file or sym. link? (-r $file) # is the file readable? ) { return 1; } else { return 0; } } sub executeComm { my ($comm) = @_; print "$comm\n"; system ($comm); print "$?\n"; }