in reply to Re: Re: Re: Golfing Colors
in thread Golfing Colors

I suspect you didn't test that improvement... With /./g in a list context, $& does not iterate over the values matched; it will only be equal to the last value matched by /./g. Thus, your outermost loop iterates three times, but prints #ff0000 through #ffffff each time.

If /./g were in a scalar context, as in

@_="0369cf"=~/./g;while("0369cf"=~/./g){for$b(@_){print"#$&$&$b$b$_$_\ +n"for@_}} # ^^^^^^^^^^^^^^
then using $& would work as you expected. Of course, that doesn't help with the golf. :)