Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
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


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 scrutinizing the Monastery: (12)
As of 2014-12-26 21:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (176 votes), past polls