Re: the file slurping is not working

2009-06-10 Thread Smylers
Tom Christiansen writes: > Larry wrote: > > > But we're trying very hard to get rid of most such special cases in > > Perl 6. Usually we can get the recommended Perl 6 code to just DWYM > > as a fallout of the general semantics, > > Oh. You mean like for directories containing a file whose nam

Re: the file slurping is not working

2009-06-06 Thread Tom Christiansen
Larry wrote: » Indeed, that preference is why Perl 6 can (we hope) get away with » autochomping, where Perl 5 can't (as easily). Or more accurately, » we choose not to special-case "while (<>)" as Perl 5 does (because » even Perl 5 has difficulties with files that are accidentally » "autochomped"

Re: the file slurping is not working

2009-06-05 Thread Larry Wall
On Fri, Jun 05, 2009 at 01:39:02PM +0200, Carl Mäsak wrote: : Daniel (>), Leon (>>), Daniel (>>>): : >>> Then why is it that .get works fine for $*IN? : >>> : >>> while $*IN.get -> $line { : >>>       say $line : >>> } : >>> : >> : >> Because you're using a while loop instead of a for loop ;-) : >

Re: the file slurping is not working

2009-06-05 Thread Carl Mäsak
Daniel (>), Leon (>>), Daniel (>>>): >>> Then why is it that .get works fine for $*IN? >>> >>> while $*IN.get -> $line { >>>       say $line >>> } >>> >> >> Because you're using a while loop instead of a for loop ;-) > > Worse. The code I wrote has a subtle but horrible error. The condition will >

Re: the file slurping is not working

2009-06-05 Thread Daniel Carrera
Leon Timmermans wrote: Then why is it that .get works fine for $*IN? while $*IN.get -> $line { say $line } Because you're using a while loop instead of a for loop ;-) Worse. The code I wrote has a subtle but horrible error. The condition will fail as soon as you hit a blank line!!

Re: the file slurping is not working

2009-06-05 Thread Leon Timmermans
> > Then why is it that .get works fine for $*IN? > > while $*IN.get -> $line { >        say $line > } > Because you're using a while loop instead of a for loop ;-) Leon

Re: the file slurping is not working

2009-06-05 Thread Daniel Carrera
Carl Mäsak wrote: Aruna (>): I tested the below code on parrot-1.1.0 and it read all the lines in the file and tested same code on the latest git update (4th June 2009), it outputs only the first line. That's what C<$file.get> does -- it gives you one line per default. You want C<$file.lines>.

Re: the file slurping is not working

2009-06-05 Thread Aruna Goke
Carl Mäsak wrote: Aruna (>): I tested the below code on parrot-1.1.0 and it read all the lines in the file and tested same code on the latest git update (4th June 2009), it outputs only the first line. That's what C<$file.get> does -- it gives you one line per default. You want C<$file.lines>.

Re: the file slurping is not working

2009-06-05 Thread Carl Mäsak
Aruna (>): > I tested the below code on parrot-1.1.0 and it read all the lines in the > file and tested same code on the latest git update (4th June 2009), it > outputs only the first line. That's what C<$file.get> does -- it gives you one line per default. You want C<$file.lines>. // Carl