I'm assuming you're calling the script something like this:
or have that data filled out in a form with this script as its action. The code below can get the data off the GET line, using a function in the CGI module. This doesn't deal at all with URL encoding (%20 is a space, etc).
Code:
#get the two values
my $username = param('username');
my $value = param('value');
Next is how the text file is created. Most programming languages have at least three file modes. Read, write, append. For the first and the last, the file must exist to open it. Read only lets you read from the file. Append only lets you write, but it adds the data you write to the end of the file that already exists. The write method will attempt to create the file if it doesn't exist, and if it does exist, it truncates (removes) what's there already.
In perl, you can specify which of these modes (as well as many more) to use by the first character in the "filename".
[tt]open FILE, "[red]
>[/red]username/$username".".txt"[/tt]
The [red]
>[/red] is what makes this file opening for write. To append, you use [red]
>>[/red]. To read, you can either put nothing there, or use [red]
<[/red], but the nothing is more common.
Read about the open function here for more information:
Also, I agree you shebang looks odd. You probably meant it to be this:
#!
[red]/[/red]user/bin/perl ----------------------------------------------------------------------------------
...but I'm just a C man trying to see the light