Problems? Is your data what you think it is? | |
PerlMonks |
Re: Adding Default Values [for BEGINNERS]by OfficeLinebacker (Chaplain) |
on Dec 21, 2006 at 22:54 UTC ( [id://591215]=note: print w/replies, xml ) | Need Help?? |
Well, since you've exposed your dirty little secret, and that takes courage, I'm going to join you: I too follow NASCAR. Go #20. Anyway, here's a quick and dirty fix. Note the first two lines after !#. That's the most important part. The second most important part, and the part that fixes your problem, is chomping the input BEFORE looking at it to determine whether you want to use the default file. Before you chomp the input, it has a newline character in it, which resolves to true if you test it. If the person only hit enter, and you chomp the value, THEN you have a value that will test false. Note there are lots of other ways to improve your code and this is "quick and dirty" at best.
I like computer programming because it's like Legos for the mind.
In Section
Seekers of Perl Wisdom
|
|