Hi Ovid, * Ovid <[EMAIL PROTECTED]> [2007-04-16 12:45]: > 1. The server I tested this on had one entry in the PATH which > didn't exist on the server, so I first check to see if stat($_) > returns a true value.
But you do it with a double stat, hmm. > 2. There was a precedence problem. The not (!) binds tighter > than the bitwise and (&), so parentheses were needed. Oh yeah. I wrote this with only a single grep doing both the absolute check and the mode check at first, then decided to pull them apart for readability. Generally I prefer the low-precedence set of boolean ops so I don’t have good instincts for composition with the other set. I should have stuck with `not`… oh, and *tested* the code after rewriting it. use Config; use File::Spec::Functions; use File::stat; use Fcntl qw( :mode ); $ENV{PATH} = do { my $sep = $Config{path_sep}; join $sep, ( map { /(.*)/ } grep { my $s = stat($_); $s and not $s->mode & S_IWOTH } grep { file_name_is_absolute($_) } split( /\Q$sep/, $ENV{PATH} ), ); }; (And this time it’s tested.) -- *AUTOLOAD=*_;sub _{s/(.*)::(.*)/print$2,(",$\/"," ")[defined wantarray]/e;$1} &Just->another->Perl->hack; #Aristotle