Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

capture a carriage return from <STDIN>
I have a script that pauses while the reader reads the intro text, and
askes them to press return to continue.  At the moment I capture the
input from STDIN into a variable called $waste, do nothing with it, and
continue anyway.  The script complains when it runs...

Name "main::waste" used only once: possible typo at ./addUsers line 66.

Is there a better way of doing this?

Report this thread to moderator Post Follow-up to this message
Old Post
D. J. Birkett
04-20-05 08:56 PM


RE: capture a carriage return from <STDIN>
Subject: capture a carriage return from <STDIN>

I have a script that pauses while the reader reads the intro text, and
askes them to press return to continue.  At the moment I capture the
input from STDIN into a variable called $waste, do nothing with it, and
continue anyway.  The script complains when it runs...

Name "main::waste" used only once: possible typo at ./addUsers line 66.

Is there a better way of doing this?


I don't know if it's "better" but you may wish to consider:

...
print q{To continue, please press "Enter":};
<>;
...

Report this thread to moderator Post Follow-up to this message
Old Post
John Moon
04-20-05 08:56 PM


Re: capture a carriage return from <STDIN>
D. J. Birkett wrote:
> I have a script that pauses while the reader reads the intro text, and
> askes them to press return to continue.  At the moment I capture the
> input from STDIN into a variable called $waste, do nothing with it, and
> continue anyway.  The script complains when it runs...
>
> Name "main::waste" used only once: possible typo at ./addUsers line 66.
>
> Is there a better way of doing this?

Yes, don't capture the input.

print 'Press return to continue.';
<STDIN>;
# continue running the program


John
--
use Perl;
program
fulfillment

Report this thread to moderator Post Follow-up to this message
Old Post
John W. Krahn
04-20-05 08:56 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PERL Beginners archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 07:17 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.