http://qs1969.pair.com?node_id=248670


in reply to Trying to Create and Write to a file

I'm guessing that you'll need to chomp the value of $CorE after you've read it in from STDIN. You're trying to match on just the value 'C', when perl is probably seeing 'C\n' as its value.

-c

Replies are listed 'Best First'.
Re: Re: Trying to Create and Write to a file
by IPstacks (Novice) on Apr 07, 2003 at 16:48 UTC
    That did the trick, thanks c

      Just as a suggestion, you may also want to consider ignoring the case of the input. For example if someone enters 'c' then it doesn't pass the conditional. You could use a simple regex such as if ($CorE =~ /^C/i) which would also eliminate the need for chomping.