I'm not sure what proof you have that your strings are reverting. Be aware that both @contents and $s are the results of calling a method on an object. If you are expecting a substitution on a string returned by contents_list to be refs, then then you really want content_refs_list instead. The HTML::Entity method contents_list only returns a list, not a list of refs. It seems you're changing something other than what you want.

As for being able to change your arguments in Perl, take a look at this simple test case:

my @foo = qw( aaaaaaaa bbbbbbbb cccccccc dddddddd eeeeeeee ffffffff); sub foo { for ( @_ ) { $_ =~ s/(.)\1/$1/ || return; print $_ . "\n"; foo( $_ ); } } foo @foo; print @foo;

The above produces this:

aaaaaaa aaaaaa aaaaa aaaa aaa aa a bbbbbbb bbbbbb bbbbb bbbb bbb bb b ccccccc cccccc ccccc cccc ccc cc c ddddddd dddddd ddddd dddd ddd dd d eeeeeee eeeeee eeeee eeee eee ee e fffffff ffffff fffff ffff fff ff f abcdef


In reply to Re: Modifying a parameter to a recursive function by mr_mischief
in thread Modifying a parameter to a recursive function by CoDeReBeL

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.