http://www.perlmonks.org?node_id=1200201

Perl6 knows no __DATA__ construct. One can however, use the =finish pod marker and the $=finish variable for similar effect.
use v6; say $=finish; # says "foo" =finish foo
Edit: Renamed as per advice


holli

You can lead your users to water, but alas, you cannot drown them.

Replies are listed 'Best First'.
Re: Small Perl 6 discoveries I, __DATA__
by jahero (Monk) on Sep 29, 2017 at 07:47 UTC

    I believe that might not be accurate. See this (disclaimer: untested) https://design.perl6.org/S26.html#Data_blocks

    Rats. Should have tried it first.

    ===SORRY!=== Error while compiling c:\temp/test.p6 Pod variable $=data not yet implemented. Sorry. at c:\temp/test.p6:8 ------> say $=data<HERE><Virtues>;

      It says right across the top of the page you linked:
      Note: these documents may be out of date. For Perl 6 documentation see docs.perl6.org; for specs, see the official test suite.
      I'm going to have to point out that docs.perl6.org is not always correct either, and let the significance of the last phrase sink in. The test suite is constantly tweaked to match the behavior of the latest perl6 code, so effectively the only specification for Perl6 is perl6 (caps intentional).
        The test suite is constantly tweaked to match the behavior of the latest perl6 code

        Are you including new tests that land corresponding to bug fixes that land? (Which is to say, most of the changes to the test suite.) Or just removals and corrections of bad tests?

Re: Small Perl 6 discoveries II, Rats
by Anonymous Monk on Sep 27, 2017 at 15:09 UTC
    > say 1.111111111111111111111 1.11111111111111111604544
        So the question becomes, why does perl6 print all those wrong digits?
        > perl5 -E 'say 1.111111111111111111111' 1.11111111111111 > perl6 -e 'say 1.111111111111111111111' 1.11111111111111111604544
      If you want arbitrary precision rational arithmetic, you can use a FatRat:
      > say 1.111111111111111111111.FatRat 1.111111111111111111111
        If you want arbitrary precision rational arithmetic, you can use a FatRat

        I didn't know about FatRats (yes, I know very little about perl6) - so I had a bit of a play (on rakudo-star-2017.07) and encountered confusing results:
        > my $x = 1.111111111111111111111.FatRat; my $y = 1.111111111111111111 +111.Rat; $x - $y 0 > $x == $y True > say $x 1.111111111111111111111 > say $y 1.11111111111111111604544 >
        On the bases that $x-$y==0 and $x==$y one is led to believe that $x and $y are exactly equivalent.
        Yet, say() presents us with different values.

        Are the 2 rationals equivalent ?
        If so, then why does say() output different values ?
        If not, then why do both $x-$y==0 and $x==$y evaluate as "True" ?

        Interestingly, 1.11111111111111111604544 is the value of the double 1.1111111111111111 (16 decimal places) rounded to 23 decimals:
        C:\>perl -le "printf '%.22e\n', 1.1111111111111111;" 1.1111111111111111604544e+000\n
        Perhaps this ties in with:
        > my $x = 1.111111111111111111111.FatRat; my $y = 1.1111111111111111.N +um; $x - $y 0 > $x == $y True
        How does one coerce perl6 into displaying the actual numerator and denominator of these rationals ?

        Cheers,
        Rob
        If the Rat class isn't any more accurate than a Num, but it's much slower, then what purpose does it serve?