in reply to Re: Re: Re: Re: variable function thingy
in thread variable function thingy

use strict; sub foo { print "fooing\n"; &{\&{"foo"}}; \&{"foo"}; &{"foo"}; # not following the strictures

Please elucidate.

On what basis are you claiming this is "perfectly legal". I've just gone through the Camel and your referenced pages and find nothing to support this claim.

My opinion:

All of the above constructs should be legal if the first is. \& is not a single op. The \ operates on whatever follows. The & is part of the function name.

Replies are listed 'Best First'.
Re: (Re:)+ variable function thingy
by broquaint (Abbot) on Oct 20, 2002 at 17:56 UTC
    On what basis are you claiming this is "perfectly legal"
    On the basis that it parses correctly and runs correctly without so much as a peep from strict or warnings. I'd say that's a pretty solid basis.
    I've just gone through the Camel and your referenced pages and find nothing to support this claim.
    Just because it isn't in the Camel doesn't mean that it's not in perl, it just means that it is so obscure it was left out of the Camel for the safety and sanity of perl programmers the world over ;)
    HTH

    _________
    broquaint

      That is a completely lame reason. Recommending the usage of undocumented/undefined features is bad. Claiming the legality of undocumented/undefined behaviour is sub-optimal.

      But I was wrong.1   broquaint is correct, the construct:

      use strict 'refs';
      my $v = \&{'foo'};Is legal.

      It is documented as the as the one exceptional case necessary to let AUTOLOAD run under stricture.

      Thanks for the education.


      1 This is emblazoned so you won't miss the info re: strict, not because an error of mine is noteworthy per se. I wish.

      Updated as broquaint tells me I misrepresented his words.