use strict; use warnings; require 5.8.0; my $string = "......bytes...."; local $/=\1; open FH, "<", \$string or die $!; while (my $byte = ) { #do your stuff with $byte } close FH;