Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Trying to Create and Write to a file

by c (Hermit)
on Apr 07, 2003 at 16:45 UTC ( #248670=note: print w/replies, xml ) Need Help??


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

  • Comment on Re: Trying to Create and Write to a file

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://248670]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (1)
As of 2021-06-19 10:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)












    Results (92 votes). Check out past polls.

    Notices?