Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: Basic help with mapping

by pg (Canon)
on Nov 22, 2005 at 04:57 UTC ( #510640=note: print w/ replies, xml ) Need Help??

in reply to Basic help with mapping

map works... but there is a feeling that it is not needed. If I do it, I will simply:

use strict; use warnings; use Data::Dumper; my $AoH_orig = [ { 'title' => 'aaa-aaa', 'name' => 'tom' }, { 'title' => 'bbb-bbb', 'name' => 'kathy' }, { 'title' => 'ccc-ccc', 'name' => 'bill' } ]; for (@$AoH_orig) {$_->{'title'} =~ s/-/_/g}; print Dumper($AoH_orig);

Which gives you what you wanted:

$VAR1 = [ { 'name' => 'tom', 'title' => 'aaa_aaa' }, { 'name' => 'kathy', 'title' => 'bbb_bbb' }, { 'name' => 'bill', 'title' => 'ccc_ccc' } ];

Comment on Re: Basic help with mapping
Select or Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://510640]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2015-08-01 01:06 GMT
Find Nodes?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...

    Results (285 votes), past polls