3 # If your operating system supports it, write a program that works
4 # like ln, making a hard link from the first command-line argument
5 # to the second. (You don't need to handle options of ln or more
6 # arguments.) If your system doesn't have hard links, just print
7 # out a message telling which operation you would perform if it
8 # were available. Hint: this program has something in common with
9 # the previous one--recognizing that could save you time in coding.
15 use File::Spec::Functions;
18 if (scalar(@ARGV) != 2) {
19 die "Usage: $0 source target";
21 my ($source, $target) = @ARGV;
23 $target = catfile($target, basename($source));
26 link $source $target or die "Unable to link "$source" to "$target": $!";