I don't think you can do what you want exactly. But I certainly may be
wrong!
Using a pair may do the trick, but my Pair foo outside a Hash is weak.
The other way around it is to do something like this I use often:
class MyPair {
has Bool $.b;
has Str $.s;
}
sub x(--> MyPair) {
my Bool $b = True;
my Str = "foo";
my $obj = MyPair.new(:$b,:$s);
$obj;
}
say x; # OUTPUT
On Mon, Oct 27, 2025 at 05:34 ToddAndMargo via perl6-users <
[email protected]> wrote:
> On 10/27/25 3:13 AM, Tom Browder wrote:
> > On Sun, Oct 26, 2025 at 19:46 ToddAndMargo via perl6-users <perl6-
> > [email protected] <mailto:[email protected]>> wrote:
> >
> > Hi All,
> >
> > What am I doing wrong here? I want
> > two things in my "returns".
> >
> >
> > [2] > sub x() returns Bool,Str {}
> > ===SORRY!=== Error while compiling:
> > Missing block
> > ------> sub x() returns Bool⏏,Str {}
> > expecting any of:
> > new name to be defined
> >
> > Yours in confusion,
> > -T
> >
> >
> > Return a List of a defined Bool and Str:
> >
> > sub x(--> List) {
> > my Str $s = "hello";
> > my Bool $b = True;
> > $b, $s;
> > }
> >
> > say x;
> > OUTPUT: (True hello)
> >
> > -Tom
>
> Hi Tom,
>
> Dang. List does not tell me what they are.
>
> Thank you for the help.
>
> -T
>