in reply to What is Perl way to simultaneously assign to three separate arrays?
DB<152> %project =() DB<153> $_="A B C" => "A B C" DB<154> m/(?<url>\w) (?<id>\w) (?<title>\w)/; $project{ $+{id} } + = { %+ } => { id => "B", title => "C", url => "A" } DB<155> \%project => { B => { id => "B", title => "C", url => "A" } }
(line 154 should be two, but the debugger can't keep matches alive after quitting eval)
if you prefer AoAs just do push @projects, [ values %+ ] , ... and so on.
|
|---|