Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Press enter to exit

by 2teez (Priest)
on Jul 27, 2013 at 10:19 UTC ( #1046646=note: print w/ replies, xml ) Need Help??


in reply to Press enter to exit

Hi Anonymous Monk,
Just one 'kobo' note in addition.

but it is not working because i presume this command if ($fi eq \n )
Yes, you presume right, for

  1. Though there is \n, but it usage is not literal. Am sure you must have seen that it is used in a double quote like this "\n" in this case. See this for more.
  2. After you have use chomp, your variable is no longer "\n".See McA's wisdom above.
  3. kcot showed wonderful and better alternative for doing what you wanted. However, if you still want to follow through on what you initially wrote then, DRY i.e Don't Repeat yourself!!!. i.e Instead of writing this
    print "Please press enter to quit \n"; my $fi = <STDIN>; chomp $fi
    as many times as possible, put it in a sub, then call the sub, each time you need it.

If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me


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://1046646]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (12)
As of 2014-08-28 07:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (257 votes), past polls