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


in reply to converting from switch to given-when

Try this:

given ($selection) { when ([wxID_YES]) { $self->Wx::LogStatus('You pressed: "Yes"' ) + } when ([wxID_NO]) { $self->Wx::LogStatus('You pressed: "No"' ) + } when ([wxID_CANCEL]) { $self->Wx::LogStatus('You pressed: "Cancel"') + } }
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'