The main question is whether you want to make a copy of your original structure or simply to modify it in place. If you're going for the modify approach, then you really shouldn't use map I feel because map conveys the sense of returning a list of something. But you can make your for loop a bit more concise:
for (@$AoH_orig) { $_->{title} =~ s/-/_/g; }
If you do want to make a copy, then you should really make it a deep copy because otherwise your two arrays will really be identical, since they have the same references in them. For this you can use map:
my $AoH_new = [ map { my %tmp = %$_; $tmp{title} =~ s/-/_/g; \%tmp } @ +$AoH_orig ];
The key points here are a) I am calling map in list context and returning the result as an array reference, since that's what you want $AoH_new to be (otherwise you'd have to make it a real array like @AoH_new) and b) I need to actually copy the hash for each element in order to make a completely new structure.

In reply to Re: Basic help with mapping by Errto
in thread Basic help with mapping by bradcathey

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.