I have begun writting my first mod_perl module.  I figured that I would
get the logic working perl first, considering I am new at the language
in general.  Well, low and behold, I have a few syntax error which I
don't know how to resolve.  One issue is how to declare a local
variable, and the other is a problem with my open statement.  Can
someone take a look and help me out?  Here is the code:


#! /usr/bin/perl

use strict;

sub process {
        local $str = @_;
        return $str;
}


my $filename="testinput.txt";
my $fh;

unless( open $fh, $filename) {
        print STDERR "Cannot open file [$filename]\n";
}

while($<fh>) {
        chomp;
        print process($_);
}

1;
__END__

This is the error I am getting:

Global symbol "$str" requires explicit package name at ./test.pl line 6.
Bareword found where operator expected at ./test.pl line 18, near "$<fh"
        (Missing operator before fh?)
Bareword "fh" not allowed while "strict subs" in use at ./test.pl line
18.
syntax error at ./test.pl line 18, near "$<fh"
syntax error at ./test.pl line 21, near "}"
Execution of ./test.pl aborted due to compilation errors.

Reply via email to