$n=4;
print $n." -- ".(--$n||'no more'),".\n" while $n;
# output on perl 5.26 5.24 and before
4 -- 3.
3 -- 2.
2 -- 1.
1 -- no more.
# output on perl 5.28
3 -- 3.
2 -- 2.
1 -- 1.
0 -- no more.
####
$n=4; print $n." -- ",(--$n||'no more'),".\n" while $n;
#^--- is a comma now!
# output on perl 5.28
4 -- 3.
3 -- 2.
2 -- 1.
1 -- no more.
####
use B::Concise;
sub sample { $n=4; print $n." -- ".(--$n||'no more'),".\n" while $n; }
B::Concise::compile('-exec', "sample", \&sample)->();
__DATA__
# output in perl 5.24
main::sample:
1 <;> nextstate(main -12 99bottles.pl:2) v:{
2 <$> const[IV 4] s
3 <#> gvsv[*n] s
4 <2> sassign vKS/2
5 <;> nextstate(main -12 99bottles.pl:2) v:{
6 <0> enter
7 <#> gvsv[*n] s
8 <|> and(other->9) K/1
9 <0> pushmark s
a <#> gvsv[*n] s
b <$> const[PV " -- "] s
c <2> concat[t3] sK/2
d <#> gvsv[*n] s
e <1> predec sK/1
f <|> or(other->g) sK/1
g <$> const[PV "no more"] s
h <2> concat[t5] sKS/2
i <$> const[PV ".\n"] s
j <@> print sK
k <0> unstack s
goto 7
l <@> leave K*
m <1> leavesub[1 ref] K/REFC,1
B::Concise::compile(CODE(0x5ef428))
1 <;> nextstate(main -12 99bottles.pl:2) v:{
2 <$> const[IV 4] s
3 <#> gvsv[*n] s
4 <2> sassign vKS/2
5 <;> nextstate(main -12 99bottles.pl:2) v:{
6 <0> enter
7 <#> gvsv[*n] s
8 <|> and(other->9) K/1
9 <0> pushmark s
a <#> gvsv[*n] s
b <$> const[PV " -- "] s
c <2> concat[t3] sK/2
d <#> gvsv[*n] s
e <1> predec sK/1
f <|> or(other->g) sK/1
g <$> const[PV "no more"] s
h <2> concat[t5] sKS/2
i <$> const[PV ".\n"] s
j <@> print sK
k <0> unstack s
goto 7
l <@> leave K*
m <1> leavesub[1 ref] K/REFC,1
# output in 5.28
main::sample:
1 <;> nextstate(main -8 99bottles.pl:2) v:{
2 <$> const[IV 4] s
3 <#> gvsv[*n] s
4 <2> sassign vKS/2
5 <;> nextstate(main -8 99bottles.pl:2) v:{
6 <0> enter
7 <#> gvsv[*n] s
8 <|> and(other->9) K/1
9 <0> pushmark s
a <#> gvsv[*n] s
b <#> gvsv[*n] s
c <1> predec sK/1
d <|> or(other->e) sK/1
e <$> const[PV "no more"] s
f <+> multiconcat(" -- ",-1,4,-1)[t5] sK
g <$> const[PV ".\n"] s
h <@> print sK
i <0> unstack s
goto 7
j <@> leave K*
k <1> leavesub[1 ref] K/REFC,1
B::Concise::compile(CODE(0x4fe6e0))
1 <;> nextstate(main -8 99bottles.pl:2) v:{
2 <$> const[IV 4] s
3 <#> gvsv[*n] s
4 <2> sassign vKS/2
5 <;> nextstate(main -8 99bottles.pl:2) v:{
6 <0> enter
7 <#> gvsv[*n] s
8 <|> and(other->9) K/1
9 <0> pushmark s
a <#> gvsv[*n] s
b <#> gvsv[*n] s
c <1> predec sK/1
d <|> or(other->e) sK/1
e <$> const[PV "no more"] s
f <+> multiconcat(" -- ",-1,4,-1)[t5] sK
g <$> const[PV ".\n"] s
h <@> print sK
i <0> unstack s
goto 7
j <@> leave K*
k <1> leavesub[1 ref] K/REFC,1