Hi ROB6789,
Based on your last post, you already know how to get some input from the user through the console (that's a Unix term I guess, in Windows it's the command prompt). In Perl, you use an "if" statement to have your program do different things based on a condition. And "eq" is how you compare two strings to see if they are equal. So you could say
Based on your question, I'm guessing you haven't programmed much before. In that case, Perl maybe isn't the best choice of a first language. But if you want to stick with Perl, you should buy the book Learning Perl by Randal Schwartz. It's a great first book for Perl.my $var = <STDIN>; if ($var eq "something") { # this code only gets called if $var contains "something" } else { # this code only gets called if $var doesn't contain "something" }
In reply to Re: How do i create different commands for different user inputs
by Errto
in thread How do i create different commands for different user inputs
by ROB6789
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |