Help for this page

Select Code to Download


  1. or download this
    my %h = map { chomp; (split /\s+/, $_, 2)[0,1] } <DATA>;
    print Dumper \%h;
    ...
    two 2
    one
    three 3 X
    
  2. or download this
    $VAR1 = { 
              'three' => '3 X',
              'one' => undef,
              'two' => '2'
            };
    
  3. or download this
    my %h = map { defined ? $_ : $default }
            map { chomp; (split /\s+/, $_, 2)[0,1] } <DATA>;