Perl Home
PERL Functions
© 2011 TutorialsPoint.COM
|
PERL rmdir Function
Syntax
Definition and Usage
Deletes the directory specified by EXPR, or $_ if omitted. Only deletes the directory if the directory is empty.
Return Value
0 on failure
1 on success
Example
Create one directory testdir inside /tmp and Try out following example:
#!/usr/bin/perl -w
rmdir ("/tmp/testdir") || die ("error in deleting directory: $?");
|
It will produce following results:
If directory is empty then it will be deleted
otherwise error message will be generated.
| |
|

|
|
|