Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: [Perl 6] List of length 2 or...

by blazar (Canon)
on Oct 23, 2008 at 18:29 UTC ( [id://719114]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    aleph:~ [19:27:57]$ perl -wMData::Dumper -e 'print Dumper {undef() => 
    +undef}'
    Use of uninitialized value in anonymous hash ({}) at -e line 1.
    $VAR1 = {
              '' => undef
            };
    
  2. or download this
    my %h = map { defined ? $_ : $default }
            map { chomp; (split /\s+/, $_, 2)[0,1] } <DATA>;
    
  3. or download this
    my %pairs = map { chomp; 
        my($k,$v)=(split ' ', $_, 2)[0,1];
        defined $k ? ($k => $v // $default) : () } <DATA>;
    
  4. or download this
    my %pairs = map { chomp; 
        map @{ ([], [@$_, $default], $_)[scalar @$_] }, 
        [split ' ', $_, 2] } <DATA>;
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://719114]
help
Chatterbox?
and the web crawler heard nothing...

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

    No recent polls found