On Mon, Mar 13, 2017 at 11:32:25AM -0700, Sean McAfee wrote:
> In Perl 5 ...
> 1 == (my ($script) = $page->find('//script'))
> or die "Other than exactly one script element found";
> Can a similar expression that avoids an intermediate array variable be
> written in Perl 6?
This does
The == operator coerces to Numeric, so like:
> sub one-thing { return ("hi",) }
sub one-thing () { #`(Sub|93867233982256) ... }
> one-thing.Numeric
1
(mentioned in https://docs.perl6.org/routine/$EQUALS_SIGN$EQUALS_SIGN)
I think my does indeed do some fancy precidenting with the assignment.
--B
On Mon, Mar 13, 2017 at 12:37 PM, Will Coleda wrote:
> Works the same in Perl 6, and you can avoid the parens. Using helper
> subs that return one or two item lists, here's some sample code:
>
> $ perl6
> > sub one-thing { return ("hi",) }
> sub one-thing () { #`(Sub|140454852043936) ... }
> > 1
Works the same in Perl 6, and you can avoid the parens. Using helper
subs that return one or two item lists, here's some sample code:
$ perl6
> sub one-thing { return ("hi",) }
sub one-thing () { #`(Sub|140454852043936) ... }
> 1 == my $script = one-thing
True
> $script
(hi)
> sub two-things { r