How does opendir work in Perl 6?

Posted by sid_com on Stack Overflow See other posts from Stack Overflow or by sid_com
Published on 2010-02-26T16:47:16Z Indexed on 2010/03/16 13:46 UTC
Read the original article Hit count: 421

Filed under:
|

Hello! Can someone tell me, why the "opendir" doesn't work?

#!/usr/bin/env perl6
use v6;

my $file = 'Dokumente/test_file';

if ( my $fh = open $file, :r ) {
    for $fh.lines -> $line {
    say $line;
    }
} else {
    say "Could not open '$file'";
}


my $dir = 'Dokumente';

my $dh = opendir $dir err die "Could not open $dir: $!";

Output:

Hello, World!
Line 2.
Last line.

Could not find non-existent sub &opendir current instr.: '_block14' pc 29 (EVAL_1:0) called from Sub '!UNIT_START' pc 1163 (src/glue/run.pir:20) called from Sub 'perl6;PCT;HLLCompiler;eval' pc -1 ((unknown file):-1) called from Sub 'perl6;PCT;HLLCompiler;evalfiles' pc 1303 (compilers/pct/src/PCT/HLLCompiler.pir:707) called from Sub 'perl6;PCT;HLLCompiler;command_line' pc 1489 (compilers/pct/src/PCT/HLLCompiler.pir:794) called from Sub 'perl6;Perl6;Compiler;main' pc -1 ((unknown file):-1)

© Stack Overflow or respective owner

Related posts about perl6

Related posts about opendir