PhantomStar has asked for the wisdom of the Perl Monks concerning the following question:
I have it working to where I can write to a file and read that file, but when I try to use the same file to match it doesn't seem to work.
Here is the writing portion:
It seems to write fine, but it does seem like its adding a space to the end of every line in this file.<TR><TD valign=top align=center> <INPUT TYPE="RADIO" NAME="efile" VALUE="ban_account.txt"> </TD><TD align=left> <font face=arial size=-1> ban_account.txt -- Account names that are banned. </TD></TR> ########## EDIT IMPORTANR DATA FILES ########## sub edity { $rf="qpwoeirutytiwasonyturieowpq"; } sub edit { $file = $INPUT{'efile'}; $password = $INPUT{'password'}; &checkpassword; open (DAT,"<$path/data/$file"); @headers = <DAT>; #chomp(@headers); close (DAT); print <<EOF; <FORM METHOD=POST ACTION="$cgiurl"> <INPUT TYPE="HIDDEN" NAME="password" VALUE="$password"> <INPUT TYPE="HIDDEN" NAME="efile" VALUE="$file"> <font face=arial><B>Edit the file: <font color=red>$file</FONT></B> <BR><BR><font size=-1>Enter or change all the html you want in the tex +t box below</font><BR><BR> <TEXTAREA NAME="filecontents" ROWS=25 COLS=65 wrap="OFF"> @{[join("",@headers)]} </TEXTAREA> <BR><BR> <INPUT TYPE="SUBMIT" NAME="edit_final" VALUE="Save your changes"> </form> EOF &Footer; exit; }
Here is the match portion, that DOESN'T WORK.
Please let me know if anyone can see anything wrong with this code.### CHECK BANNED ACCOUNT ### open (ACC, "$path/data/ban_account.txt"); @ban_account = <ACC>; close (ACC); foreach $account_line(@ban_account) { chomp($account_line); if ($INPUT{'account'} =~ /$account_line/) { print <<EOF; <BR> <table cellpadding=5 border=1 cellspacing=0 bgcolor=$table_bg> <TR><TD align=center><font face=$font_face size=$font_size color=$text +_table> YOUR ACCOUNT HAS BEEN BANNED. </TD></TR></TABLE> <BR><BR> EOF &Footer; exit; } }
PhantomStar
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Need help reading and writing to a file.
by chromatic (Archbishop) on Sep 16, 2001 at 02:29 UTC | |
|
Re: Need help reading and writing to a file.
by kschwab (Vicar) on Sep 16, 2001 at 02:54 UTC | |
|
Re: Need help reading and writing to a file.
by Zecho (Hermit) on Sep 15, 2001 at 16:19 UTC |