Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

More Lvalue Subs - Double-Barreled Closures

by Zaxo (Archbishop)
on Sep 12, 2003 at 04:54 UTC ( [id://290924]=perlmeditation: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    {
        my ($foo,@foo);
        sub foo () :lvalue {
            wantarray ? @foo : $foo;
        }
    }
    
  2. or download this
    foo = 'Flintstone';
    (foo) = qw/Fred Wilma Pebbles/;
    # Hmmm, odd bug, the lines following demonstrate what works
    # print scalar(foo), ', ', $_, $/ for foo;
    print join ' & ', foo;
    print ' ', scalar(foo),$/;
    
  3. or download this
    {
        my $foo;
        sub foo () :lvalue {
            defined wantarray ? $foo : undef $foo;
        }
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://290924]
Approved by belg4mit
Front-paged by BrowserUk
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2024-04-20 03:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found