Thank you all for your reply.
I greatly appreciate your help.
Loan
--- Steve Grazzini <[EMAIL PROTECTED]> wrote:
> Loan Tran <[EMAIL PROTECTED]> wrote:
> > mkdir ("/storage/systbl/") || die "$!\n";
> >
> > The code above does not check if the dir exist.
> > Can you modify it please. Thanks.
>
> You can check whether a directory exists with the -e
> and -d file test operators.
>
> $ perldoc -f -X
>
> But as soon as you write code like:
>
> unless (-e $dirname) {
> mkdir $dirname or die "mkdir: $dirname: $!";
> }
>
> You've got a race condition.
>
> Since mkdir() fails if the directory exists, it's
> usually better to just call it and check *why* the
> call failed (if it failed) afterward.
>
> use Errno;
>
> unless (mkdir $dirname) {
> die "mkdir: $dirname: $!"
> unless $!{EEXIST} and -d $dirname;
> }
>
> Season to taste.
>
> --
> Steve
>
> perldoc -qa.j | perl -lpe '($_)=m("(.*)")'
>
> --
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
>
__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]