On 9/7/19 4:25 PM, Jorge Almeida wrote:
Sorry about the title, it's the best I can do...

#!/usr/bin/perl
use strict;
use warnings;
my $num=12;
my $target=pack('n', $num);
symlink($target, "foo") || die $!;

It dies with "No such file or directory"
No symlink is created. What I want is a symlink named "foo" pointing
to a 2-byte string. Yes, it would be a broken symlink. (Yes, this is
how I want it).

Symlink() can create broken links, the problem is the target. What to
do? (And why doesn't it work?)

my main question is, why?? when newbies want to do something wacky like this, there is usually a different larger goal. this is known as the XY problem. they ask about X but really need to do Y.

so what is your real goal? it likely has nothing to do with symlinks but you seem to think that is a solution.

and a quick guess is that you have 0 bytes in your packed string and filenames can't have 0 bytes. packing a small number into an int will have 0 bytes in it.

uri

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to