in reply to Re: On References to the Unnamed
in thread On References to the Unnamed

Golfed:

sub new_scalar_ref { \(my $x) }

This is one of The Few Places Where \() Syntax is UsefulTM. Another favorite is DBI->bind_columns().

Replies are listed 'Best First'.
Re^3: On References to the Unnamed
by jdporter (Paladin) on Mar 15, 2005 at 19:53 UTC
      Ha! Cool. Hard to beat that. :)

      Inlined that'd be do { \my $x }, I suppose.

      Update: As Anonymous Monk mentions below. This kinda makes me wonder what gensym did except maybe to encapsulate this?

Re^3: On References to the Unnamed
by leriksen (Curate) on Mar 21, 2005 at 00:39 UTC
    Another is in Getopt::Long (example slightly golfed)

    GetOptions('in|i=s' => \my $indir, 'out|o=s' => \my $outfile, 'log|l=s' => \my $logfile, 'cp|c=s' => \my $cp, 'help|?' => \my $help, man => \my $man) or pod2usage(2);

    ...it is better to be approximately right than precisely wrong. - Warren Buffet