in reply to Re^3: Bit manipulation of a bit stream to generate different elements of an array with each nibble taking either 0 or 1 in perl
in thread Bit manipulation of a bit stream to generate different elements of an array with each nibble taking either 0 or 1 in perl
I find it kind of hard to read. The /e alternative I mentioned would be something like:
I didn't include the first one on my post because it felt it would be too many advanced features for a beginner (s/// operator, regex, capture, eval, /g modifier, x operator). But now that I've actually written it down, I find it better than $1$1$1$1: it's actually more intuitive when you read it, and looks less like line noise.$stream =~ s/(.)/$1 x 4/eg; # Without extra space $stream =~ s/(.)/($1 x 4).' '/eg; # With extra space
|
|---|