#ex_13-3 #Learning Perl Appendix A, Exercise 13.3 ($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 } link($old,$new) || die "Cannot link $old to $new: $!";