in reply to Re^6: What would you change?
in thread What would you change?

never knew that the l-valueness of a subroutine was allied to its prototype

It's not. &vec calls vec of the package in which you happen to be, not the core function.

>perl -e"&vec()" Undefined subroutine &main::vec called at -e line 1.

The (presumably non-existant) vec in your current package is not an l-value sub, thus the error messag. You can't use & on core functions.

Replies are listed 'Best First'.
Re^8: What would you change?
by BrowserUk (Patriarch) on May 20, 2008 at 00:45 UTC

    Good point and (probably) a good call, but I'm now wondering about the difference betweem the error message you got and that I got: Can't modify non-lvalue subroutine call ...?

    I'll have to see if I can reproduce the situation. I was running my REPL at the time.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      The difference is that I didn't use it as an lvalue. Perl checks whether or not it can be used as an lvalue before trying to execute it.
      >perl -e"&vec()" Undefined subroutine &main::vec called at -e line 1. >perl -e"&vec() = 1" Can't modify non-lvalue subroutine call at -e line 1.