Dan Kogai wrote:
~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.
On Apr 08, 2006, at 19:34 , Dan Kogai wrote:
does not. The problem of ~stringify, ?boolify, and +numify is that
they are infix operators so it goes the opposite direction.
s/infix/prefix/
Sorry.
Dan the Perl6 Golfer on the Bunker
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.
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;
:-)
Damian
Folks,
This is a poetic quine (or quine-maker) in perl5.
open myself, $0 and print ;
The same thing in perl6 would be:
my $self = open $*PROGRAM_NAME; for =$self { say }
or
my $self = open $*PROGRAM_NAME; say for =$self;
or
my $self = slurp $*PROGRAM_NAME; print $self;
or even