http://qs321.pair.com?node_id=148760


in reply to case escape characters

Wow.. it took me a bit to decipher what you are trying to do. I can say pretty much off the bat that you are going to want to do some overhauling on how you're thinking this snippet through. You're trying to replace a character with something new (in this case you're adding an escaped character).. how do we perl-ites usually do that? uh-huh.. you guessed it s/// (or tr///, but that's not as appropriate here). You'll prolly want to throw the entire string at your sub and return it's modified form.. something like
$string = adjust_case('s', "stuff\n"); print $string; # which would print Stuff with a newline

Prolly not exactly what you're lookin for, but hopefully will allow you to see your objective a little differently.

-SynZero

Sleep Deprived