How to implement real time updates and interactive chats in a webpage

I want to build a website.. All i know is shell and perl programming.. so i started with perl cgi and was successful in developing a page that asks username and password and authenticates the user...
Now can some one tell me how to add IRC(interactive chat) and real time updates to my webpage, like facebook, or gmail does..
what language or technology should i learn for this...? :wall:

PS: my test bed involves Apache/2.2.20 (Ubuntu), perl5 and Mozilla firefox.

HTTP isn't well-suited to "real-time" things, it loads a page then quits. "real-time" updates really mean a javascript something on the webpage repeatedly loading some URL to see if it has anything new to report.

So it's not just an HTTP thing, not just a server-side thing, and not just a javascript thing. It's all three. Trying to master all of them at once may be a bit of a tall order.

thanks for ur answer.. will try to learn javascript and get back.. :cool: