On Apr 08, 2006, at 18:45 , Damian Conway wrote:
Dan Kogai wrote:


With that understood, I would welcome if we have a version of slurp () which unconditionally returns a scalar.


That'd be:

        ~slurp $file;

:-)


Very clever.  But still not good enough when it comes to autoboxing.

  { ~slurp }($*PROGRAM_NAME).print

and even

  (~slurp $*PROGRAM_NAME).print

works as expected but since "~slurp $file" is really ~(slurp $file),

  $*PROGRAM_NAME.~slurp.print

does not. The problem of ~stringify, ?boolify, and +numify is that they are infix operators so it goes the opposite direction.

Oh, while I was testing all these on pugs, I came across this.

  ##
  say $*PROGRAM_NAME.slurp.elems;
  ##

This says 1 but

  ##
  my @lines = $*PROGRAM_NAME.slurp; say @lines.elems;
  ##

says 3.  This I am confused.

Dan the Perl6 Golfer on the Bunker

Reply via email to