1

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

use strict;
use Perl6::Slurp;

my $contents = slurp(*DATA);

__END__
line 1
line 2

fails.

ivo Welch
  • 2,427
  • 2
  • 23
  • 31

1 Answers1

3

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;

__DATA__
hello
world
mob
  • 117,087
  • 18
  • 149
  • 283