in reply to Net::Telnet disappearing data :)

When you check for end of file, you are not using the object method ($connect->eof). Instead, the perl builtin eof is being used. Although, it might be working in your case ("eof" without an argument uses the last file read), it would be more correct and safer to use the object method.

...the second snippet of code fixes it...but i don't know how to break the loop looking for eof or timeout...

You can use the timed_out method to test for timeout.

my $lineid = 0; while ($lineid < 20) { my $linedata = $connect->getline; # check for eof or time-out _before_ using the data last if $connect->eof or $connect->timed_out; # now save the line push(@data,$linedata); $lineid++; }

Replies are listed 'Best First'.
Re: Re: Net::Telnet disappearing data :)
by DesolateCoder (Initiate) on Jul 24, 2001 at 01:34 UTC
    Thank-you much....this works :) Also a problem with original method is my Prompt=> /regex/ was hosed....so maybe i can use the array up front...have to play.
    my $experience = "nonexistent"; my $thoughts = "worthless"; unless ($experience) { print "You're $thoughts\n"; }