user3623221
user3623221

Reputation: 43

Perl syntax error when opening a file

I have written a sub routine and when I run my program, I am getting the error message : "syntax error at line74, near 'open' " Is it possible the error is because I've used my to declare the content array?

my @content = do{
        local $/ = \$width;
        <$fh>;
    }



    open(OUT, ">", $outfile) or die "cannot open \n"; #this is line 74
    binmode(OUT);
    foreach ( @content ){
        print OUT $_;
    }

    close(OUT);

Upvotes: 0

Views: 162

Answers (1)

mpapec
mpapec

Reputation: 50637

You're missing semicolon in line before that,

my @content = do{
    local $/ = \$width;
    <$fh>;
}; # semicolon

Upvotes: 3

Related Questions