Im super new to perl and i dont quite understand this.

I create a sub, and send $text. Then i split $_ into @lines.
Now if i do a foreach loop and change the $line in @lines, i then want to save that and return as $list. But its a list so if i go
$text = @lines #im just going to get the number of lines right?

how do i return it as the changed $text?