What's wrong with doing ...
$self->{'content'} =~ s/foo/bar/g;
... you know just don't use the get_set method.
update Added tested code.
Plankton@Chum_Bucket:~/perl/perlmonks> cat test.pl #!/usr/local/bin/perl -w use strict; package Test; sub new{ my( $class, $value ) = @_; return bless { content => $value }, $class; } 1; package main; my $thing = Test->new( 'empty' ); print $thing->{'content'} . "\n"; $thing->{'content'} = 'the quick brown fox'; print $thing->{'content'} . "\n"; $thing->{'content'} =~ s[\b(.)][\U$1]g; print $thing->{'content'} . "\n"; Plankton@Chum_Bucket:~/perl/perlmonks> ./test.pl empty the quick brown fox The Quick Brown Fox

Plankton: 1% Evil, 99% Hot Gas.

In reply to Re: regex transforms of object attributes by Plankton
in thread regex transforms of object attributes by Tuppence

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.