in reply to what's faster than .=

Well, between $var .= $data and $var = $var . $data use the ".=", much better, since the second always rewrite all the data, and the first just append.

I don't know if you are getting this for a file or socket, but if you are, use

read(SOCKET, $var , 1 , length($var) )
and read() will append the data faster than use a buffer var to than write to it!

But think, you really need to read byte by byte?! If you are doing this because you are using socket, take a look in IO::Select, can help.

Graciliano M. P.
"The creativity is the expression of the liberty".