On my computer, if I enter 1 for $opt2, I get the print out I am aperl monk1. The "1" at the end comes from print $opt2.
Maybe you forgot to put in a new line after "I am a Perl Monk" and so couldn't see that you were in fact printing out $opt2 ? The Perl print command does not automatically add a new line at the end of a line. If you wish to add a new line every time you print you can set the perl variable $\ to "\n". See perlvar for more information.
Best, beth
update pointed out the "1" being contributed by print $opt2.
In reply to Re: Help with a perl code
by ELISHEVA
in thread Help with a perl code
by varunreeves
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |