ivo Welch ivo Welch - 1 year ago 90
Perl Question

Perl6::Slurp of DATA

could someone please post a reference example of Perl6::Slurp with the DATA filehandle?

use strict;
use Perl6::Slurp;

my $contents = slurp(*DATA);

line 1
line 2


mob mob
Answer Source

A reference to a typeglob is a suitable argument to Perl6::Slurp::slurp, as the perldoc demonstrates.

use Perl6::Slurp;

$hw = slurp \*DATA;
print $hw;