idiomatic perl - reading streams