in reply to perl6: problem with prompt

Your snippet works for me with the current development version of rakudo under linux.

Could you please try to build the latest rakudo from source and see if it still fails?

Also please add this line after the prompt:

say $num.PARROT;

and tell me what it prints.

Perl 6 - links to (nearly) everything that is Perl 6.

Replies are listed 'Best First'.
Re^2: perl6: problem with prompt
by Anonymous Monk on Jun 06, 2010 at 09:50 UTC
    i have tried your suggestion:
    my $num = prompt("Please write a number : "); say $num.PARROT; $num +=3; say $num.PARROT;
    the result is this:
    String
    Num

    it gives the same result whether the number below 10 or more
    regards
      Can you please also try it with a current development version of Rakudo?
        i have downloaded randomly a previous version; it is
        setup-parrot-1.7.0.exe
        setup-parrot-1.7.0-rakudo-22.exe
        and yes it is working okay with any number
        also i have tried the previous version 2.3.0 and it gives error results like 2.4.0
        sorry moritz, i have'nt the tools to build it, it needs a c compiler,
        regarding the above example: in the domain of negative numbers the results is correct for any numbers
        such as entering number -7 will give the results
        -7
        -4

        thanks
        Hi
        after a lot of trials i have succeeded in installing the latest rakudo from source on windows xp, the above problem is the same, it seems prompt function adds additional letter to the right of the one digit number ,
        i can get around such behaviour with this code until the problem resolved in future releases:
        use v6; my $num = prompt("Please write a number : "); if $num.chars == 2 {$num = substr $num, 0, 1;} say $num; $num +=3; say $num;
        regards