John W. Krahn wrote:
> 
>          #extract year, month, day when $xfile was last modified
>          # eg 2008/July/9
>          my $dir = strftime '%Y/%b/%-d', localtime( ( lstat $xfile )[9] )

I hoped that was what I was looking for, but the format %- creates nothing and
the 'd' is simply.

> 
>          if ( ! -e $dir ) {
>              mkpath [ $dir ], 0, 0750 or die "Cannot mkpath '$dir' $!";
>          }

There is no problem with calling mkpath on an already-existing directory. OTOH
it is documented to throw a fatal error if the path cannot be created so there
is no point in checking the return value (which is the number of directories
created by the call).

Rob

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to