Tutorials Point


  Perl Home

  PERL Functions

© 2013 TutorialsPoint.COM


  Home     References     About TP     Advertising  

PERL rmdir Function



Advertisements

Syntax

rmdir EXPR

rmdir


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.


Advertisements


  

Advertisements