$stream =~ s/(.)/$1$1$1$1 /g; # could be rewritten using /e and x 4