#ex_13-2
#Learning Perl Appendix A, Exercise 13.2
($old, $new) = @ARGV; # name them
if (-d $new) { # new name is a directory, need to patch it up
    ($basename = $old) =~ s#.*/##s; # get basename of $old
    $new .= "/$basename"; # and append it to new name
}
rename($old,$new) || die "Cannot rename $old to $new: $!";
