Help for this page

Select Code to Download


  1. or download this
    %hash =(
      a => ($b =~ /(\d+)/ ? $1 : 0),
      b => "test b",
    );
    print "$_=#$hash{$_}#\n" for keys %hash;
    
  2. or download this
    %hash = (
      a => (($b =~ /(?<tag>\d+)/) ? $+{tag} : 0),
      b => (($b =~ /(?<tag>test)/) ? $+{tag} : 0),
    );
    print "$_=#$hash{$_}#\n" for keys %hash;