in reply to Need help with Win32::SerialPort

As anonymonk puts it, "loop":
while( $run ) { my $newline = $objPort->lookfor; if ( $newline ne '' ) { print $newline; $run = 0 if $newline =~ /reason to stop/; } }

Another possibility is that your are_match() settings are matching "\n" and leaving "\r" on your lines, so when then print to the terminal, each line of text is overwritten. Try directing the output to file. That should show you if this is happening.

Also, be careful with "\n", because it can mean "\r\n" in some windows perl environments. You should consider using the hexadecimal escapes "\x0A" and "\x0D", as no magic happens with them.

Update: Fixed escape sequences. Thanks to BrowserUk.


TGI says moo

Replies are listed 'Best First'.
Re^2: Need help with Win32::SerialPort
by GoTerpsGo (Novice) on Jun 11, 2007 at 12:26 UTC
    Arrrrrrgh.... I apparently did everything you already suggested except for one thing - I used != instead of ne. Damnit... Thx for the help.