Hello

Try this one:

use strict;

use Data::Dumper;


my $x = sqrt 2;

my @li= grep{/\d+/} split//,$x;


print Dumper \@li;



$ 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
>
>
>

Reply via email to