for my $file ( $file1, $file2, $file ) { my $f = "$dir/$file"; $ftp->put( $f ) or warn "could not put $f: $!\n"; my $remote_size = get_remote_size( $f ); my $local_size = -s $f; if( $remote_size != $local_size ) { warn "$f not transferred correctly (local=$local_size, remote=$remote_size)\n"; } }