use strict; use warnings; my $Usage = "Usage: $0 [-f] directory_path\n"; my $force; if ( @ARGV > 1 and $ARGV[0] eq '-f' ) { $force = shift; } die $Usage unless ( @ARGV == 1 ); my $dirname = shift; if ( -e $dirname and ! $force ) { die "$dirname exists. Use '-f' option to delete the existing $dirname\n$Usage"; } ...