Did you try symlink('/home/apuntes', '/home/scripts')
? (Your question mentions it without the / before home.) It should work, returning 1 on success and 0 (and setting $!) on failure.
But normally only root would have write access to /home
; are you running it as root?
This works fine for me:
sudo perl -wE'say symlink("/home/ysth","/home/xysth") || "Error: $!"'
printing 1 the first time and "Error: File exists" the second time.
Running sudo strace perl -wE'say symlink("/home/ysth","/home/xysth") || "Error: $!"'
gives (after a lot of other stuff):
symlink("/home/ysth", "/home/xysth") = 0
write(1, "1\n", 21
) = 2
and running a second time gives:
symlink("/home/ysth", "/home/xysth") = -1 EEXIST (File exists)
write(1, "Error: File exists\n", 19Error: File exists
) = 19
What happens when you try?