title: How can I convert expect script to perl scprit?
body: <p>I never use perl script before. I have already done expect script, is there any way to convert it to perl?</p>
  
  <p>I am trying to learn perl script right now.
  Any idea could help!</p>
  
  <pre><code>foreach addr $addr {
  if {$addr eq {}} continue;
      set timeout 180
      match_max 1000000
      spawn telnet $addr
      expect {
      "*timed out*"   {puts "Host not responding"; continue}
      "'^]'."                                 {sleep .1}
      }
      expect "*login*"        {send "$user\r"}
      expect "*assword:*"     {send "$pass\r"}
      expect {
      "Login incorrect"   {puts "Bad Password or User"; exit}
      -re {[#&gt;] ?$}           {send "page-off\r"} 
      }
      log_file $customer\-License-$date.log
      expect -re {[#&gt;] ?$}
      send "show clock\r"
      sleep .5
      expect -re {[#&gt;] ?$}    
      send "show docsis channel utilization\r"
      sleep .5
      expect -re {[#&gt;] ?$}
      send "show clock\r"
      sleep .5
      expect -re {[#&gt;] ?$}
      sleep .5
      send -- "\r\rexit\r"
  send "\r"
  puts "Connection closed, connecting to next chassis\r"
      sleep 1
      log_file
  expect eof;
  }
  </code></pre>
  
  <p>Thanks a lot!</p>