Help for this page

Select Code to Download


  1. or download this
    my @interesting = ();
    while(<DATA>) {
    ...
        push @interesting, $1 if m/^(?:attribute|value): (.*)$/;
    }
    my %attributes = @interesting; # magic
    
  2. or download this
    my %attributes = grep { length } map { m/^(?:attribute|value): (.*)$/ 
    +and $1 } <DATA>;
    
  3. or download this
    my %dataObjs = ();
    
    ...
        push @interesting, $1 if m/^(?:attribute|value): (.*)$/;
    }
    $dataObjs{$dataObj} = { @interesting };
    
  4. or download this
    my %dataObjs = ();
    
    ...
        $att                        = $1 if m/^attribute:\s+(.+)/;
        $dataObjs{$dataObj}->{$att} = $1 if /^value:\s+(.+)/;
    }