Note: I'm doing this all from the REPL using This is Rakudo Star version 2019.03.1 built on MoarVM version 2019.03 implementing Perl 6.d.
From euler project #22 there is a names.txt file similar to "JERE","HAI","ELDEN","DORSEY","DARELL","BRODERICK","ALONSO", ...
When I read that in, split and sort it I get the list of names as I'd expect.
for '../names.txt'.IO.slurp.split(',').sort -> $name {
say $name;
}
That prints out
...
"ZONIA"
"ZORA"
"ZORAIDA"
"ZULA"
"ZULEMA"
"ZULMA"
Now if I add comb()
for '../names.txt'.IO.slurp.split(',').sort -> $name {
say $name.comb;
}
I'm getting
...
(" Z O N I A ")
(" Z O R A ")
(" Z O R A I D A ")
(" Z U L A ")
(" Z U L E M A ")
(" Z U L M A ")
However, if I just run from the repl;
> "ZULMA".comb
I get
(Z U L M A) # Note the lack of quotes
Why is comb
behaving differently in these two scenarios?
It's not behaving differently. In one case the quotes are a syntax element - part of the code - and in the other case data read verbatim from the file:
"ZULMA".comb
'"ZULMA"'.comb
The data is different. not the behaviour.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With