Nameless scalars

 | Perl | 0 Comments | 0 TrackBacks

Unlike the special constructs which make creating references to anonymous hashes and arrays as easy as pie, there is unfortunately no easy-and-quick way in Perl to create so-called nameless scalars. Kind of a bummer.

Can this be viewed as a serious shortcoming of Perl? Could be or not.

Well there is still hope. Instead you will have to do something like the following:

my $scalar_ref = \do{ my $anon_scalar = 'what the heck' };

Now it is up to us Perl folks to figure out what this actaully means and how one should go about using it effectively (or not).

Borrowed from one of my favorite Perl books which is called 'Perl Best Practices' by Damian Conway.

No TrackBacks

TrackBack URL: http://www.kiffingish.com/cgi-bin/mt/mt-tb.cgi/139

Leave a comment

Recent Entries

Stupid light-pole
Damn. I bashed in the left side of my car against that stupid light-pole while backing out of the ... »
Enjoy life
The man standing next to me was wearing a fancy suit and carrying a leather briefcase in his right ... »
Gale-force winds
"The true (golf) pilgrim wanders off to the outlying, the more humble and obscure courses. For it is on ... »
Secret powers
The front nine was quite a display of supernaturally and (almost) perfectly consistent golfing gusto: Par, par, par, par, ... »
No more winter greens
The cool, windy and grayish afternoon calls me onward. It's drizzling on my windshield but I do not care. ... »