Help for this page

Select Code to Download


  1. or download this
    $ perl -wE 'use Data::Dump; my %h; dd \%h; $_ = "a_b_c"; $h{/a_(.*)_c/
    +} = boom_$1; dd \%h'
    {}
    Can't call method "boom_" on an undefined value at -e line 1.
    
  2. or download this
    $ perl -wE 'use Data::Dump; my %h; dd \%h; $_ = "a_b_c"; $h{/a_(.*)_c/
    +} = "boom_$1"; dd \%h'
    {}
    Use of uninitialized value $1 in concatenation (.) or string at -e lin
    +e 1.
    { 1 => "boom_" }
    
  3. or download this
    $ perl -wE 'use Data::Dump; my %h; dd \%h; $_ = "a_b_c"; $h{(/a_(.*)_c
    +/)[0]} = "boom_$1"; dd \%h'
    {}
    Use of uninitialized value $1 in concatenation (.) or string at -e lin
    +e 1.
    { b => "boom_" }
    
  4. or download this
    #!/usr/bin/env perl
    
    ...
    /$re/ and $hash{$_} = join '_', $xref{$1}, $2 for keys %hash;
    
    dd \%hash;
    
  5. or download this
    {
      abc_text6_ghi  => "boom_text6",
    ...
      xxx_text10_yyy => "zoom_text10",
      xxx_text11_yyy => "zoom_text11",
    }