in reply to Symbolic Reference in Method Call
use RTF::Writer; my $rtf = RTF::Writer->new_to_file("greetings.rtf"); my $foo = \$rtf; ${$foo}->prolog(); ${$foo}->paragraph( "Hi there!" ); ${$foo}->close;
See Why it's stupid to use a variable as a variable name for why you are opening yourself up for pain. The above also passes strict.
In the end, however, these types of games generally raises the specter of an XY Problem. Why do you need a reference to the object? Is this a caching thing, which might be addressed with proper scoping?
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Symbolic Reference in Method Call
by Eily (Monsignor) on Jun 27, 2013 at 17:17 UTC | |
|
Re^2: Symbolic Reference in Method Call
by EclecticScion (Novice) on Jun 27, 2013 at 17:58 UTC |