Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

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' } ];

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://510640]
help
Chatterbox?
marto has a similar idea on the 'to do' list
[Discipulus]: 65-35 joint venture marto? ;=)
[choroba]: Fibonacci at 34!
[marto]: Discipulus, what did you have in mind?
[marto]: sort of related, have you seen sonic pi
[Discipulus]: choroba less than perl -le ' $==1,(1 x $_)=~/(^)(1|11\1 )*(?{$=++})^/, print $= for 0..10'?? congrats

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (10)
As of 2017-10-17 10:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My fridge is mostly full of:

















    Results (225 votes). Check out past polls.

    Notices?