cal has asked for the wisdom of the Perl Monks concerning the following question:
@fields = ("first","last","position","email","telephone","presider"); $database = "data/pastoral_members.txt"; sub add_record { $key = time(); $record=$key; foreach $field (@fields){ ${$field} = $q->param($field); ${$field} = filter(${$field}); $record .= "\::${$field}"; } unless (-e $database){ open (DB, ">$database") || die "Error creating database. $!\n"; } else { open (DB, ">>$database") || die "Error opening database. $!\n"; } flock DB, $EXCLUSIVE; seek DB, 0, 2; print DB "$record\n"; flock DB, $UNLOCK; close(DB); } # End of add_record subroutine.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: trouble modifying add_record subroutine
by kabel (Chaplain) on Sep 10, 2002 at 17:11 UTC | |
by cal (Beadle) on Sep 10, 2002 at 17:25 UTC | |
by kabel (Chaplain) on Sep 10, 2002 at 18:14 UTC | |
|
Re: trouble modifying add_record subroutine
by anithri (Beadle) on Sep 10, 2002 at 17:51 UTC | |
|
Re: trouble modifying add_record subroutine
by admiraln (Acolyte) on Sep 10, 2002 at 17:58 UTC | |
by cal (Beadle) on Sep 10, 2002 at 18:31 UTC | |
by admiraln (Acolyte) on Sep 10, 2002 at 21:14 UTC | |
|
Re: trouble modifying add_record subroutine
by mephit (Scribe) on Sep 10, 2002 at 20:20 UTC |