Tuesday, November 18, 2008

How to get user input in PERL

It's simple -

- The angle bracket operator to read from STDIN (see I/O operators in perlop)
- If entering 'Y' or 'N' - make sure to use 'chomp' to cut the new line character.
- @ARGV - the array that holds parameters from the command line (see perlvar)
- Getopt::Long or Getopt::Std - for more powerful handling of command line arguments
- uc - to uppercase an expression
- ucfirst - to uppercase the first letter of an expression

Later in your code, you can compare by using 'eq' or 'ne' or '==' or '!=' or
pattern matching =~ m///, thingy to move on to do what you want.....

No comments: