in reply to On References to the Unnamed
But bless \"$_", 'Foo' doesn't even work: Modification of a read-only value attempted...
You could make a "factory" for scalar refs:
Of course, this technique can be used in-line with do, if you prefer.sub new_scalar_ref { my $x; \$x }
Another idea you could consider is to bless an anonymous sub. That, at least, will throw an exception if a client ever tries to deref it as data.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: On References to the Unnamed
by gaal (Parson) on Mar 15, 2005 at 19:00 UTC | |
by jdporter (Paladin) on Mar 15, 2005 at 19:53 UTC | |
by gaal (Parson) on Mar 16, 2005 at 05:43 UTC | |
by eyepopslikeamosquito (Archbishop) on Mar 16, 2005 at 13:16 UTC | |
by gaal (Parson) on Mar 16, 2005 at 22:41 UTC | |
by leriksen (Curate) on Mar 21, 2005 at 00:39 UTC | |
|
Re^2: On References to the Unnamed
by tlm (Prior) on Mar 16, 2005 at 00:02 UTC |