Calling perl from java and file permissions

I'm trying to open up a text file read info from it, alter it and write back the alterations when a user clicks on the save button, but I've hit two issues:-

1) I can't open the file for write access as I don't have permissions - can I alter a files permissions during a program using chmod? I've tried to alter it by hand in an ftp window (to 755 from 666) but it just stays the same.

2) A button (in perl) calls a java function only as far as I can find out, can I use it to call a perl function instead? if so could I have an example like this:-

print "<button type=button onClick=\"update_file()\">Save1</button>";

update_file() being the perl sub that I'd like to call.

If I can't do this and have to call a java function can I then call the perl sub from there instead, I've tried it like this but it doesn't do anything so I'm presuming it doesn't work:-

javascript and perl are two entirely different things. Perl has no concept of javascript and the same is true in reverse. What you need to do is a send some data to your perl script via a CGI form and use that data to tell your perl script what to do, like run a certain subroutine in your perl script.

As far as the chmod goes, it is possible to change file permission with perl, use perls chmod function.

ah ok so java and perl can relate to the CGI form. So I could say have the button call a java function that sets a variable to true that is being checked by a while loop and when found to be true call the perl sub? is that the sort of thing you mean?

javascript can only communicate with the perl script via the form. Do whatever you want with the javascript, but it has to set a form field to some value and then send the form data back to the perl script to process the data. Perl then accepts the data, processes it, and sends data back to the browser. But there is never any direct interaction between perl and javascript, they operate in two different environments, they can only communicate via the form.

Perl can print javascript while it outputs html back to the web browser and fill in javascript code with whatever data is needed by the javascript to run in the web browser, but once perl outputs the html/javascript code to the web browser it has no concept of what occurs after that until some form data is sent back to the perl script via the form.

There is also AJAX which is a blending of javascript and CGI scripting, but the process is essentially the same as described above although the interaction in the web browser looks different.

Write a C program that should create a 10 element array of random integers (0 to 9). The program should total all of the numbers in the odd positions of the array and compare them with the total of the numbers in the even positions of the array and indicate ...

I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...