in reply to Re: Re: Re: Re: Re: Re: Problem creating a function
in thread Problem creating a function

If you use OUT parameters much you will get caught passing constants to them.
Perhaps, as a general rule. (It is Murphy's Law, after all.) But I highly doubt that someone is going to try to use this cleaner() to clean up a string of literal HTML.
These bugs may not immediately be obvious. You avoid this problem by not using them.
You avoid this problem by paying attention to the caveats on the API. If the doco says "Don't pass a constant", don't pass a constant. If the doco says "This function throws an exception on error", then you wrap the call with eval{}. (Or allow that your program may abort.)
... given that you can easily pass references to and from subs.
And why do references make any difference? (Hint: they don't.)
cleaner( \"to be cleaned" ); sub cleaner { my $ref = shift; $$ref =~ s/foo/bar/; }
results in the same error: Modification of read-only value attempted.

jdporter
...porque es dificil estar guapo y blanco.