in reply to Sub Params as references

What wrong assumptions have I made?

my $lines_in  = ${shift()};

you made a copy of a variable instead of using the reference to the variable. your code will work if you do:
my $lines_in = shift; [...] $$lines_in .= $_;
Tiago
Update: check out perlref if you want to know more about references.