in reply to Re^2: Newbie cmd prompt problem
in thread Newbie cmd prompt problem
"Thanks for trying to help. I really appreciate it! ..."
While I'm happy to help, you need to help us as well. Posting all your text and code in a single block without any markup makes it very difficult to read. Put your text into paragraphs within <p>...</p> tags and your code within <code>...</code> tags. Details can be found in (or linked from) "Writeup Formatting Tips"; and "How do I change/delete my post?" explains how to fix what you've already done.
After putting your code into some sort of readable layout, it would appear that what I'm talking about is pretty much the same thing that you're learning about:
$ perl -Mstrict -Mwarnings -E ' my $numone; my $numtwo; print "Please enter first number "; $numone = <STDIN>; print "Please enter second number "; $numtwo = <STDIN>; #if ($numone < $numtwo); { <--- WRONG: no semicolon here if ($numone < $numtwo) { print $numone; print $numtwo; } # elsif { <--- WRONG: should be else else { print $numtwo; print $numone; } print "Hit enter when done: "; <>; ' Please enter first number 456 Please enter second number 123 123 456 Hit enter when done:
So, in this context, "<>" is just a short-hand form of "<STDIN>": see "perlop: I/O Operators" for the full story. Also, I don't assign the user input to a variable because I don't want it and, in fact, don't really care what the user enters. This works the same:
$ perl -Mstrict -Mwarnings -E ' ... previous code unchanged ... print "Hit enter when done: "; <STDIN>; ' Please enter first number 456 Please enter second number 123 123 456 Hit enter when done: I'm all done with this!
-- Ken
|
|---|