Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: Press enter to exit

by 2teez (Vicar)
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

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1046646]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (3)
As of 2018-02-19 14:45 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (265 votes). Check out past polls.