Yes, I tested it. Here is an even more through test that worked perectly on my platform, Win2K, NTFS, Activeperl 5.6.1:
use warnings;
use strict;
my $file = 'C:/tmp/filename1.txt';
open IN, $file or die "Cannot open $file for reading:$!\n";
print "Contents of $file before linking:\n";
print while (<IN>);
close IN;
my $link = 'C:/tmp/link.txt';
if (-e $link) { unlink $link or die $!; }
link $file,$link or die "Cannot link $link to $file:$!\n";
open LINK, $link or die $!;
print "Contents of $link after linking:\n";
print while (<LINK>);
close LINK;
open (OUT, ">>", $file) or die "Cannot open $file for writing:$!\n";
print OUT "Additional content\n";
close OUT;
open IN, $file or die $!;
print "Coontents of $file after updating:\n";
print while (<IN>);
close IN;
open LINK, $link or die "Cannot open $link:$!\n";
print "Contents of $link after updating:\n";
print while (<LINK>);
close LINK;
Printed output:
Contents of C:/tmp/filename1.txt before linking:
Original contents
Contents of C:/tmp/link.txt after linking:
Original contents
Coontents of C:/tmp/filename1.txt after updating:
Original contents
Additional content
Contents of C:/tmp/link.txt after updating:
Original contents
Additional content
As you can see, the link is maintained. YMMV on other platforms.
--
Regards,
Helgi Briem
helgi AT decode DOT is
|