| Subject: | Unable to read the string |
|---|---|
| From: | sajapuram.arun.prakash@xxxxxxxxx (Arun) |
| Date: | Wed, 30 Jul 2008 21:55:22 -0700 (PDT) |
| Newsgroups: | perl.beginners |
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.
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Problems w/ MVS::JESFTP.pm, Wagner, David --- Senior Programmer Analyst --- WGO |
|---|---|
| Next by Date: | can perl program do this?, Richard Lee |
| Previous by Thread: | Problems w/ MVS::JESFTP.pm, Wagner, David --- Senior Programmer Analyst --- WGO |
| Next by Thread: | Re: Unable to read the string, Rob Dixon |
| Indexes: | [Date] [Thread] [Top] [All Lists] |