in reply to Re: Anonymous scalar ref revisited
in thread Anonymous scalar ref revisited

Certainly a funny proposal (though it bails out if the subroutine itself is unnamed, but I admit that this is a border case which we will ignore). Still I'm puzzled how this can work. What is the f in this \f supposed to mean? It can't be a reference to the subroutine f, sind this would be \&f and wouldn't be useful either. Hence it must mean that we apply \ to the result of a parameterless invocation of f, but this shouldn't work either. Which hat did you get this f out from?

-- 
Ronald Fischer <ynnor@mm.st>

Replies are listed 'Best First'.
Re^3: Anonymous scalar ref revisited
by dk (Chaplain) on Apr 07, 2010 at 08:50 UTC
    That works only because f() itself is so simple, and also because

    my $ref=undef; $$ref=4711;
    works too. That's why it's not serious, but also probably answers your question more deeply - you don't need a special syntax for anonymous scalar-ref, it gets autovivified when necessary.