#!/usr/bin/env perl6 use v6; class Term::Choose { has Str $.prompt = 'Your Choice'; has Int @.mark; has %!opt; method choose ( Array $orig_list, %!opt? ) { %!opt //= $.prompt; say "prompt: %!opt" with %!opt; %!opt //= [ @.mark ]; say "mark : %!opt[]\n" with %!opt; } } my $n = Term::Choose.new( prompt => 'AAAAA', mark => [ 5, 6 ] ); $n.choose( [ 1 .. 10 ] ); $n.choose( [ 1 .. 10 ], { prompt => 'BBBBB', mark => [ 1 .. 4 ] } ); $n.choose( [ 1 .. 10 ] );