in reply to logical solution for a array of hash
#!/usr/bin/perl -- use strict; use warnings; use Data::Dump qw/ dd /; my $record = { col1 => "value8", col2 => "value9", col3 => "value10|value11|value12", col4 => "value13|value14|value15", }; dd( $record ); SomethingUnPipeModifyRecord( $record ); dd( $record ); dd( $record->{col4} ); dd( $record->{col4}[0] ); sub SomethingUnPipeModifyRecord { my( $rec ) = @_; for my $val( values %$rec ){ my $newval = [ split /\|/, $val ]; $val = $newval; } return $rec; } __END__ { col1 => "value8", col2 => "value9", col3 => "value10|value11|value12", col4 => "value13|value14|value15", } { col1 => ["value8"], col2 => ["value9"], col3 => ["value10", "value11", "value12"], col4 => ["value13", "value14", "value15"], } ["value13", "value14", "value15"] "value13"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: logical solution for a array of hash
by spie287 (Novice) on Feb 13, 2015 at 14:39 UTC |