in reply to On References to the Unnamed

Wouldn't it be much easier to just introduce a perlvar that each time it's used, is a new scalar? I suggest $^N, New scalar.

bless \$^N, $class; bless \($^N = "some value"), $class;
I don't really see why this is needed, though. I can live with
bless \my $dummy, $class;
or, if for some strange reason I don't want to pollute the lexical scope with a $dummy,
bless \do { my $dummy }, $class;

Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }

Replies are listed 'Best First'.
Re^2: On References to the Unnamed
by Anonymous Monk on Mar 16, 2005 at 09:26 UTC
    No need for $dummy:
    sub new { my $class = shift; bless \$class, $class; }
Re^2: On References to the Unnamed
by ihb (Deacon) on Mar 16, 2005 at 09:55 UTC

    $^N is already taken.

    ihb

    See perltoc if you don't know which perldoc to read!