Skip Menu |
Report information
Id: 123380
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: djura [at] centrum.cz
Cc:
AdminCc:

Severity: (no value)
Tag: Bug
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Date: Sun, 7 Dec 2014 00:17:25 +0100
Subject: [BUG] A script that gives different results when executed from a file and when pasted into REPL
From: Jirka Daněk <djura [...] centrum.cz>
To: rakudobug [...] perl.org
Download (untitled) / with headers
text/plain 651b
$ ./perl6-m --version
This is perl6 version 2014.09 built on MoarVM version 2014.09

#############################xx

$ ./perl6-m
> say 'a'.subst(/(.)/,{$0~$0});
aa
> say "%20" ~~ /:i \%(<[0..9A..F]>**2)/;
「%20」
 0 => 「20」

> say 'a'.subst(/(.)/,{$0~$0});
2020

#############################xx

say 'a'.subst(/(.)/,{$0~$0});               # aa

say "%20" ~~ /:i \%(<[0..9A..F]>**2)/;      # 「%20」
                                            #   0 => 「20」

say 'a'.subst(/(.)/,{$0~$0});               

#############################xx

aa
「%20」
 0 => 「20」

aa

#############################xx
RT-Send-CC: perl6-compiler [...] perl.org
This is another case where it makes a difference whether the command comes on a single line or on two separate lines: $ perl6-m -e 'say "a".subst(/(.)/,{$0~$0}); say "%20" ~~ /:i \%(<[0..9A..F]>**2)/; say "a".subst(/(.)/,{$0~$0});' aa 「%20」 0 => 「20」 aa But with a newline in the echo command: $ echo 'say "a".subst(/(.)/,{$0~$0}); say "%20" ~~ /:i \%(<[0..9A..F]>**2)/; say "a".subst(/(.)/,{$0~$0});' | perl6-m aa 「%20」 0 => 「20」 2020 The behaviour differs with rakudo.parrot and rakudo.jvm: $ echo 'say "a".subst(/(.)/,{$0~$0}); say "%20" ~~ /:i \%(<[0..9A..F]>**2)/; say "a".subst(/(.)/,{$0~$0});' | perl6-p Show quoted text
> say "a".subst(/(.)/,{$0~$0}); say "%20" ~~ /:i \%(<[0..9A..F]>**2)/;
aa 「%20」 0 => 「20」 Show quoted text
> say "a".subst(/(.)/,{$0~$0});
aa Show quoted text
>
$ echo 'say "a".subst(/(.)/,{$0~$0}); say "%20" ~~ /:i \%(<[0..9A..F]>**2)/; say "a".subst(/(.)/,{$0~$0});' | perl6-j Show quoted text
> say "a".subst(/(.)/,{$0~$0}); say "%20" ~~ /:i \%(<[0..9A..F]>**2)/;
aa 「%20」 0 => 「20」 True Show quoted text
> say "a".subst(/(.)/,{$0~$0});
a True Show quoted text
>
Download (untitled) / with headers
text/plain 232b
Test PR for rakudo tree: https://github.com/rakudo/rakudo/pull/1806 If that is accepted, someone with a jvm build should check whether it needs to be fudged for rakudo-j and if it is fine there as well, this ticket can be closed.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org