A
aaron.mosiah.curtis
I downloaded some perl scripts that I can't get to compile. I think the
scripts were written for perl4 and the syntax changes in perl5 are
throwing errors about a for loop that is repeated with different
variables throughout the script.
The entire script (not very large) is visible at the following url:
http://www.mockus.us/oss/apache/script
Here is an example of the for loop:
#process mail folders
#cat together cvs messages
for i in $(ls mail/cvs*.gz | sort);do gunzip -c $i; done > cvsmail
for i in $(ls mail/cvs*[0-9] | sort);do cat $i; done >> cvsmail
When I try to complie the script, I get the following errors:
Bareword found where operator expected at script.pl line 7, near "$(ls"
(Missing operator before ls?)
Use of /c modifier is meaningless without /g at script.pl line 12.
Bareword found where operator expected at script.pl line 12, near "for
i in $(ls mail/cvs"
(Might be a runaway multi-line // string starting on line 7)
(Do you need to predeclare for?)
Unquoted string "vs" may clash with future reserved word at script.pl
line 12.
syntax error at script.pl line 7, near "for i in "
sort is now a reserved word at script.pl line 12.
As best as I can tell, the compiler is not recognizing ls as an
operator and is treating everything in the parenthesis as a string. The
'/' in the directory listing mail/cvs*.gz appears to be recognized as a
modifier, which is messing up the following for loop.
This looks like something I saw in a perltrap document, but I'm not
experienced enough with perl to adjust the code to the requirements of
perl5. I'll keep going over the documentation for perl5, but in the
mean time, if anyone can help me fix this error, I'd appreciate it.
Alternatively, if anyone knows how I can obtain and install perl4 on my
windows box, that might fix the problem as well.
scripts were written for perl4 and the syntax changes in perl5 are
throwing errors about a for loop that is repeated with different
variables throughout the script.
The entire script (not very large) is visible at the following url:
http://www.mockus.us/oss/apache/script
Here is an example of the for loop:
#process mail folders
#cat together cvs messages
for i in $(ls mail/cvs*.gz | sort);do gunzip -c $i; done > cvsmail
for i in $(ls mail/cvs*[0-9] | sort);do cat $i; done >> cvsmail
When I try to complie the script, I get the following errors:
Bareword found where operator expected at script.pl line 7, near "$(ls"
(Missing operator before ls?)
Use of /c modifier is meaningless without /g at script.pl line 12.
Bareword found where operator expected at script.pl line 12, near "for
i in $(ls mail/cvs"
(Might be a runaway multi-line // string starting on line 7)
(Do you need to predeclare for?)
Unquoted string "vs" may clash with future reserved word at script.pl
line 12.
syntax error at script.pl line 7, near "for i in "
sort is now a reserved word at script.pl line 12.
As best as I can tell, the compiler is not recognizing ls as an
operator and is treating everything in the parenthesis as a string. The
'/' in the directory listing mail/cvs*.gz appears to be recognized as a
modifier, which is messing up the following for loop.
This looks like something I saw in a perltrap document, but I'm not
experienced enough with perl to adjust the code to the requirements of
perl5. I'll keep going over the documentation for perl5, but in the
mean time, if anyone can help me fix this error, I'd appreciate it.
Alternatively, if anyone knows how I can obtain and install perl4 on my
windows box, that might fix the problem as well.