# New Ticket Created by "Carl Mäsak"
# Please include the string: [perl #92686]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=92686 >
<daniel-s> I've noticed I've been doing this alot when I'm opening a file
my $file_in = open "jokes.txt";
my @jokes;
for $file_in.lines -> $line
{
@jokes.push($line);
}
<daniel-s> is there a shorter way of doing the same thing?
<jnthn> my @jokes = lines("jokes.txt")
<daniel-s> awesome, thanks jnthn++
<masak> shouldn't that be lines("jokes.txt".IO) ?
<masak> S32/Str:395 seems to indicate lines(Str) works on the string,
not on the contents of a file with that name.
<masak> rakudo: say lines("Joke 1: not very funny\nJoke 2: a little
funny\nJoke 3: extremely funny").perl
<p6eval> rakudo ae5bea: OUTPUT«Operation not permitted in safe mode
in 'Safe::forbidden' [...]
<masak> ...but Rakudo seems to be lagging.
* masak submits rakudobug :)
There's also S32/IO:886, which contains the definition of lines(IO),
further strengthening this theory.