Hi all! On Sun, 31 Oct 2021 15:14:07 +0800 Alice <al...@coakmail.com> wrote:
> Hello > > Try this one: > > use strict; > > use Data::Dumper; > > > my $x = sqrt 2; > > my @li= grep{/\d+/} split//,$x; > > > print Dumper \@li; > Or in raku: > ("" ~ sqrt(2)).comb().grep(* ne ".").map(+*) (1 4 1 4 2 1 3 5 6 2 3 7 3 0 9 5 1) > > > $ perl t1.pl > > $VAR1 = [ > > '1', > > '4', > > '1', > > '4', > > '2', > > '1', > > '3', > > '5', > > '6', > > '2', > > '3', > > '7', > > '3', > > '1' > > ]; > > > Regards > > Alice > > On Sun, Oct 31, 2021 at 2:58 PM ToddAndMargo via perl6-users < > perl6-us...@perl.org> wrote: > > > Hi All, > > > > Without going into why (it is a secret), how do I turn > > > > > my $x = sqrt 2 > > 1.4142135623730951 > > > > into an array of integers? > > @y[0] = 1 > > @y[1] = 4 > > @y[2] = 1 > > @y[3] = 4 > > @y[4] = 2 > > @y[5] = 1 > > > > etc. > > > > > > Many thanks, > > -T > > > > > > -- Shlomi Fish https://www.shlomifish.org/ https://www.shlomifish.org/open-source/projects/fortune-mod/ Summer Glau gave Richard III a horse free-of-charge and let him keep his kingdom for himself. — https://www.shlomifish.org/humour/bits/facts/Summer-Glau/ Please reply to list if it's a mailing list post - https://shlom.in/reply .