briandfoy / LearningPerl6_Downloads

The downloads for LearningPerl6.com, here as a backup

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

find_moth_genera.p6 doesn't quite work

tenther opened this issue · comments

commented

Hi:

I'm running Rakudo Perl 6.d on Ubuntu 18.04. I downloaded the "Learning Perl6" sample code and tried the first example. The program find_moth_genera.p6 checks for a command line argument, but then reads from standard in. So this hangs waiting for input:

$ perl6 ./find_moth_genera.p6 ../DataFiles/Butterflies_and_Moths.txt

But this works:

perl6 ./find_moth_genera.p6 ../DataFiles/Butterflies_and_Moths.txt <
./DataFiles/Butterflies_and_Moths.txt
1-7. BRITISH BUTTERFLIES....

I'd suggest a fix but I need to get further in the book.

commented

adding a use v6.c to the beginning of that script makes it work; v6.d changed the behavior of $*ARGFILES inside of sub MAIN; FWIW, the *@*ARGS trick is cool and i haven't seen it anywhere before.

commented

Cool--that works. Thanks!