[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] scrolling chat logfile



gene.ray@excite.com wrote:
> 
> I'm a newbie using macperl and cgi and I have a question.  I have finally
> figured out how to write and array with a form to a logfile and then read
> the logfile using another cgi script.  I'm doing this for a web chat and
> what I want to do is limit the total number of entries on the log file to
> about ten (because I want the file to remain a relatively constant small
> size)  I have discovered the unshift and the shift commands but I'm just
> having trouble getting it to do what I want it to do. (add a new entry at
> the bottom and delete the oldest entry at the top of the list.  Should I try
> and write an array within an array or something like that? If anyone has any
> suggestions that would be great! 
> 

shift() and unshift() work on the beginning of an array.
pop() and push() work on the end of an array.

If you want to add at one end and remove from the other end,
you should use push() and shift(), or unshift() and pop().

Ronald

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org