This may be a little off topic, but I would appreciate anyone who codes in Perl, to convert the following mIRC alias into Perl syntax/code. I would greatly appreciate this.

Code:
 
alias test {
  if ($isfile(test.txt)) { goto process }
  :process

  var %fl = $lines(test.txt)

  if (%fl >= 1) { 

    var %rline = $rand(1,%fl)

    echo -a $read(test.txt,%rline)

    write $+(-dl,%rline) test.txt

    goto process  
  }
}




Explanation about what the code is doing:

I have a text file called 'test.txt'. This text file has data on each line. The above code reads a random line from the text file, echoes the data, then it removes the line in the text file containing the data. Then the process restarts again untill the text file is empty.

I need a Perl script that will do exactly the same thing as above.