As simple as that, how can I read input from STDIN in Perl6?
I reckon there’s many ways of doing it, but I’m interested in the most idiomatic Perl6 solution.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The standard input file descriptor in Perl6 is
$*IN(in Perl5 the*STDINtypeglob had a reference to the STDIN file descriptor as*STDIN{IO}).One way of reading from standard input is the following:
In fact,
lines()without an invocant object defaults to$*IN.lines().An alternative that uses a local variable is:
Would be cool to see more alternative ways of doing it.