in reply to RE: Re: Mode of created files
in thread Mode of created files

You could do that, sure... in that case you just need to use stat to get the mode of the file.
my $mode = (stat "foo")[2];
But I think you could use umask, still... and it may make it easier. Try something like this:
my $mode = (stat "foo")[2]; my $mask = 777 - join '', (($mode&0700)>>6, ($mode&0070)>>3, ($mode&0007)); umask oct $mask;
I'm not sure if this is absolutely right (please someone correct me if it isn't), but it seemed to work for the test cases I tried.

Replies are listed 'Best First'.
RE: RE: RE: Re: Mode of created files
by setantae (Scribe) on Mar 28, 2000 at 03:17 UTC
    Man, I wish I could vote you up twice for this little gem:join '', (($mode&0700)>>6, ($mode&0070)>>3, ($mode&0007)); That's exactly what I was after!

    setantae