in reply to mini-golf: convert integer into list of powers of two

31

(on a 32 bit perl only the first 31 bits may be used, on a 64 bit one, it's the first 63. I can't tell perl the number is unsigned.

Jenda
Enoch was right!
Enjoy the last years of Rome.

Replies are listed 'Best First'.
Re^2: mini-golf: convert integer into list of powers of two
by tobyink (Canon) on May 24, 2012 at 12:30 UTC

    That's 32 by my reckoning...

    Using the assign-within-grep trick I applied to BrowserUK's solution, it is possible to take it down to 31 though:

    perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'