perllearner has asked for the wisdom of the Perl Monks concerning the following question:
hello perl gurus..
i have a short script i need to run to grab barcode scans into a variable which then checks if the scanned input is a number etc. what i need is to scan the barcode and get a carriage return automatically. also the auto CR needs to be done only if the STDIN is != "" and if there is a 1/2 sec delay after the scan so that no more accidental scans will be accepted..
following is my wild shot at it.. which obviously doesnt work..
print "Scan in Bar Code: "; if(<STDIN> == "") { print "\n"; } else { sleep(1/2); print "\r"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: getting an auto carriage return on STDIN
by matija (Priest) on Mar 15, 2004 at 15:43 UTC | |
|
Re: getting an auto carriage return on STDIN
by Limbic~Region (Chancellor) on Mar 15, 2004 at 15:38 UTC | |
|
Re: getting an auto carriage return on STDIN
by Abigail-II (Bishop) on Mar 15, 2004 at 15:41 UTC |