in reply to CHMOD Question
#!/usr/bin/perl -w use strict; # de(clare|fine) variables: my $filename = 'my.file'; # set mask for "readable only by user who runs this script": umask 077; # create a file with perms defined by above mask: open (FH, ">$filename") or die "Error opening $filename: $!"; print FH "foo\n"; close FH or die "Error closing $filename: $!";
If you've not used umask before, this Unixy tutorial does a decent job explaining the numbers.
cheers,
Don
striving toward Perl Adept
(it's pronounced "why-bick")
Update: corrected mispeling of timtowdi in title
|
|---|