Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Press enter to exit

by McA (Curate)
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


Comment on Re: Press enter to exit
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (11)
As of 2014-11-26 15:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (171 votes), past polls