title: Is it possible to use perl/ajax to read a file line by line while the file is written by another program?
body: <p>It is similar to the question being asked here<a href="https://stackoverflow.com/questions/23287537/how-to-read-from-file-line-by-line-using-ajax-request-while-file-is-written-by-o">How to read from file line by line using ajax request while file is written by other program using java?</a> I have a file that will be populated with command line outputs generated from  a remote machine. What I would like to do is every time something gets written in the file, I want to use perl (or javascript but I am quite dubious about it) to capture it and display what is being written in an opened webpage. Ideally each line should be shown in the html as soon as it is written in the file like the way how it is generated in the terminal. </p>
  
  <p>My difficulty is that I am not sure how I should do the polling - detecting something is being written in the file - and how I can capture the line at real time. </p>
  
  <p>That being said, another possibility I have thought of is to change my script on the remote machine and dump the terminal output into a div of my website. This would avoid writing, reading and realtime polling but not even sure if this is possible?</p>