in reply to Forcing array context

If I interpret your intent correctly, you want to convert a scalar to an anonymous array of its chars in a manner that allows it to be used as part of another expression without using the regex engine, which I assume to be because this could be part of an expression embedded in a regex itself and you need to avoid recursive calls that cause the regex engine to blow up?

You could try one of these:

do{{push@_,chop;redo if length};@_} do{while($£=chop){push@_,$£};@_}

Both should be usable anywhere an anonymous array can be used. The caveat is that the order of the characters is reversed, but that is easily dealt with.


Okay you lot, get your wings on the left, halos on the right. It's one size fits all, and "No!", you can't have a different color.
Pick up your cloud down the end and "Yes" if you get allocated a grey one they are a bit damp under foot, but someone has to get them.
Get used to the wings fast cos its an 8 hour day...unless the Govenor calls for a cyclone or hurricane, in which case 16 hour shifts are mandatory.
Just be grateful that you arrived just as the tornado season finished. Them buggers are real work.