http://www.perlmonks.org?node_id=77849


in reply to Re: (Golf) Per Mutations
in thread (Golf) Per Mutations

Didn't the rules say arbitrary list? Try this with the list (1,2,3,1) and you get incorrect output.

However here is another 57 char solution that does not suffer from this deficiency.

sub p{ @_?map{my$x=shift;@r=map[$x,@$_],&p;push@_,$x;@r}1..@_:[] }