Printed output: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;
As you can see, the link is maintained. YMMV on other platforms.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
--
Regards,
Helgi Briem
helgi AT decode DOT is
In reply to Re: Re: Re: Creating shortcuts
by helgi
in thread Creating shortcuts
by raveguy2k
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |