Hi this is Arun here, i am new to perl.Here i am trying to read a
string from the serial port but i am not able to and this is my
program:

# Read serial port until message or timeout occurs
sub ReadPort($$$) {
    (my $String, my $TimeOut, my $Display) = @_;
    $ob->read_const_time($TimeOut); # Setup timeout value in mS
    my $Reply = ""; # Initialize message
    do {
         ($Count, $Result) = $ob->read(1); # Read serial port
         $Reply .= $Result; # Build message
         print "$Result" if ($Display); # Display messages if enabled
    } while($Count > 0 and $Reply !~ m/$String/);
    print "\n" if ($Display); # Put carriage return at end of
displayed output
    if ($Reply !~ m/$String/) {
        print "ERROR: Read timed out waiting for '$String' \n";
        return(1);
    }
    return($Reply);


So just needed help for the above program to be solved.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to