http://www.perlmonks.org?node_id=1016869

simonshout has asked for the wisdom of the Perl Monks concerning the following question:

Hello monks,

I have just started teaching myself Perl a few weeks ago for a school project so please excuse me if I do not know the technical terms for some things.

My script uses mpg321 to play an mp3 file and I want to wrap some logic in an if statement that checks to see if the song is done playing.

I am trying to "watch" the LXTerminal because when mpg321 is done playing a song it will output to the terminal:

0:00 Decoding of song.mp3 finished.

So I was wondering if there was any way for me to have my script somehow watch the terminal and wait for the line above to be output.

Even if there is any way for me to know if a song has been done playing, any help is greatly appreciated. I just need a push in the right direction

Thank you all for your wisdom!