Skip to content

Instantly share code, notes, and snippets.

@paveljurca
Created February 5, 2015 09:48
Show Gist options
  • Save paveljurca/07881f4d5defcabd566f to your computer and use it in GitHub Desktop.
Save paveljurca/07881f4d5defcabd566f to your computer and use it in GitHub Desktop.
stat $mode
use 5.010.1;
use strict;
use warnings;
for (@ARGV) {
say "[ $_ ]";
say " - $_" for file_test($_);
}
sub file_test {
my $file = shift;
my @mode;
return "\Unot found" unless (-e $file);
push @mode, "readable" if -r _;
push @mode, "writable" if -w _;
push @mode, "executable" if -x _;
return @mode;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment