Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Press enter to exit

by McA (Priest)
on Jul 27, 2013 at 06:26 UTC ( #1046628=note: print w/replies, xml ) Need Help??


in reply to Press enter to exit

Hi

as always, put this on top of your script:

use strict; use warnings;

and you get the first hints for your error.

Anyway: When you chomp the input, the line seperator is removed. So, when someone is hitting enter without providing some text, the string is empty. So check against an empty string.

exit if $fi eq '';

Best regards
McA

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1046628]
help
Chatterbox?
[chacham]: there's a regexp function. if that can be used ina check() constraint...
[LanX]: Thanks, but no check constraints in MySQL :/
LanX 1 ..2 ..3 ..4 .. is erix missing ;-)
LanX is Discipulus reciting "Springtime for Hitler" ?
[choroba]: erix could tell you how to do it in Postgres
[LanX]: NOOOOOOOOOOOOOOO not again
[chacham]: wow, mysql really is as bad as i thougt
[choroba]: completion?
[LanX]: That's what he usually does when MySQL is mentioned ;-)

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (12)
As of 2017-03-30 15:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (360 votes). Check out past polls.