Basically this should be pretty simple, but I dont know what im doing:
I have a webpage where a user can add and delete members from a .htaccess file. First I read the file in and the get rid of "required user" as its not needed nor is it a user. Then I split the usernames into spaces (the username will never have a space.) I then look to see which user the user click DELETE next to and delete that user from its array by setting its array to nothing, then I join them together and print them out. I'm getting close, cause it messes up the text file everytime i try and delete someone.
my (@delete, @userid, @username); $delete[$subcounter] = param("Delete"); $userid[$subcounter] = param("userid"); $username[$subcounter] = param("username"); my $othercount = 1; while (@personal[$othercount]) { if ($personal[$othercount] eq $username[$othercount]) { $personal[$othercount] = ''; } else { } $othercount++; } my $str = ''; $str = join('require user', $personal[1], $personal[2], $personal[3], +$personal[4], $personal[5], $personal[6], $personal[7], $personal[8], + $personal[9], $personal[10]); open FILE, ">.htaccess"; print FILE $str; close FILE;
The variables at the top are the results of the form input. Please tell me what im doing wrong.

In reply to Reading in and writing files by Trihedralguy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.