foreach my $byte (unpack "C*", $string) { do something with my $byte #### while ($string =~ /./sg) { do something with $1