I want to generate some lines of Perl code by using file handling in Perl, for example:
open(FILEHANDLE, ">ex.pl") or die "cannot open file for reading: $!";
print FILEHANDLE "use LWP::UserAgent;"
....
.... some code is here
....
print FILEHANDLE "my \$ua = new LWP::UserAgent(agent => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.5) Gecko/20060719 Firefox/1.5.0.5');"
But when I compile the generator code (not the generated) I get this error:
syntax error at F:\test\sys.pl line 14, near "print"
Execution of F:\test\sys.pl aborted due to compilation errors.
What am I going to do?