sub remove { my $path = shift; if( -f $path ) { unlink $path; } elsif( -d $path ) { rmdir $path } else{ die "Dunno what to do with $path?" } }