home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!europa.asd.contel.com!darwin.sura.net!spool.mu.edu!olivea!tymix!cirrus!lando
- From: lando@cirrus.com (Dave Landis)
- Newsgroups: comp.lang.perl
- Subject: MS-DOS version of Perl
- Message-ID: <1992Sep11.163320.1837@cirrus.com>
- Date: 11 Sep 92 16:33:20 GMT
- Sender: news@cirrus.com
- Organization: Cirrus Logic Inc. Fremont, California
- Lines: 33
- Originator: lando@tango
-
-
- Using the subroutine y_or_n from page 53 in the Camel Book,
- I wrote the following on my Sparc2 workstation.
- -----------------------------------
- #! /cirrus/bin/perl
- #
-
- if( &y_or_n ("the answer is yes [y|n]: ")) {
- printf("The answer was yes!\n");
- }
-
- if(! &y_or_n ("the answer is no [y|n]: ")) {
- printf("The answer was no!\n");
- }
-
- sub y_or_n {
- local($prompt) = @_;
- printf STDOUT $prompt;
- local($answer) = scalar(<STDIN>);
- $answer =~ /^y/i;
- }
-
- #
- # yesOrno
- #
- -----------------------------------
- This routine works just fine on my Sparc2. However, I downloaded to my
- PC and my PC version of Perl did not like the useage of scalar. Are there
- any other users that have encountered a similar problem?
- --
- "He is the best friend of American liberty who is most sincere and active
- in promoting pure and undefiled religion." John Witherspoon, signer of the
- Declaration of Independence.
-