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
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"
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 ;-)
: >
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
>
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!!
>
> 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
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>.
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>.
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