in reply to Help e-mailing last 50 lines of log file

Start with a good text editor. Type in your code. Save it. Run it. If there are warnings or errors fix them. When it works as per your specification you are done. Very easy!

Oh, and be careful that $\ isn't interpreted as a magic variable. You'll probably want to use single quotes to avoid interpolation when you're opening the file. Maybe Tie::File would be more useful?