in reply to Re: Curious Symlink question
in thread Curious Symlink question

Roy,

Yes, precisely. I wondered if there was a way for a file to know what symlink was originally.

I thought maybe it got passed along or something.

Sigh, I guessed not, but one can hope.

Replies are listed 'Best First'.
Re^3: Curious Symlink question
by Roy Johnson (Monsignor) on May 02, 2005 at 23:09 UTC
    If you're calling the program using the symlink, you can use __FILE__ (or, as the others have suggested, $0). That gives you the name of the program called, and it doesn't matter whether it's a symlink or a real file. If you're calling the program using the real file name, no. A file might have numerous symlinks to it, and it doesn't have any place to keep track of them.

    Caution: Contents may have been coded under pressure.
Re^3: Curious Symlink question
by ikegami (Patriarch) on May 02, 2005 at 23:01 UTC
    You can, if you want the symlink used to start the Perl script currently being executed. It's in $0.