I am trying to write a simple script that just telnets to a device that spits out data but this device doesn't take in any input.
So I just need to telnet to the device on port 2000, and then read in line by line the data as it gets spit out. Each value is on a seperate line, and it spits out 5 of these value every once in a while.
This is an example of the data that is spit out every 5 minutes or so:
The Readings:
183
192
Blue
98223
I would like to read in each of these values and store them into variables, so that I could later put them in a file or into a database.
All I have so far is this:
use Net::Telnet ();
$instant = new Net::Telnet (Telnetmode => 0);
$instant->open(Host => '10.0.0.1',
Port => 2000);
$x = 0;
while ($x =<50) *Looping forever*
{
$instant->$waitfor('/[\n]*/');
I don't know how to read in a value and put it into a variable.
Thanks for any help.
So I just need to telnet to the device on port 2000, and then read in line by line the data as it gets spit out. Each value is on a seperate line, and it spits out 5 of these value every once in a while.
This is an example of the data that is spit out every 5 minutes or so:
The Readings:
183
192
Blue
98223
I would like to read in each of these values and store them into variables, so that I could later put them in a file or into a database.
All I have so far is this:
use Net::Telnet ();
$instant = new Net::Telnet (Telnetmode => 0);
$instant->open(Host => '10.0.0.1',
Port => 2000);
$x = 0;
while ($x =<50) *Looping forever*
{
$instant->$waitfor('/[\n]*/');
I don't know how to read in a value and put it into a variable.
Thanks for any help.