views:

122

answers:

3

I have this code:

my $orig_file_size = -s $file ;

Is throwing an error:

syntax error at ftp_4 line 33, near "$orig_file_size)"
Execution of ftp_4 aborted due to compilation errors.

Here is some more code:

 my $host ='hpp411';
 my $user ='sonalg';
 my $pw   ='Unix11!';

 my $file ='ftp_example.p_1';
 my $path ='/enbusers3.p411/vdx/af/sonalg/oldproj';
 my $orig_file_size = -s $file;

 my $ftp = Net::FTP->new($host, Debug => 1)
 or die "Could not connect to '$host': $@";
+1  A: 

The nothing wrong with that statement. The problem is probably earlier in the file.

It's tempting to say the problem is with the previous line but given the difficulty in parsing Perl the problem could be anywhere higher up the file. The first things to look for are strings which haven't been closed properly and lines missing their terminating semicolon.

Dave Webb
+1  A: 

Your error message (but not your code as shown) suggests you have a stray parenthesis after $orig_file_size.

Do you actually have:

my $orig_file_size) = -s $file ;

If so, try:

my $orig_file_size = -s $file ;

or

my($orig_file_size) = -s $file ;
dave
+4  A: 

Check your source

According to the error message, you have a closing bracket after the variable like this:

my $orig_file_size) = -s $file ;

If so, just remove it.

Yaakov Belch