newbie : Entering Strings at Terminal 
Author Message
 newbie : Entering Strings at Terminal

Hi,

I am very new to perl and am trying to adapt a program I have already.

I want to read in a string at the keyboard then output that to a file. I am
using the following code...

sub gethead {
   print "Enter heading for entry...     ";
   $_ = <STDIN>;
   $HEAD = sprintf("[%30s]", $_);

Quote:
}

The resultant output does not recognise the end of the string as entered, ie.
the CR. How do I cope with this? As always, any help is greatly appreciated.
--

... Andy


  ___  
 /| /| BNR-NITEC, Doagh Rd,                          Tel +44 (0)232 363532
|\|/ | Newtownabbey,                                 ESN      6 751   3532
| |  | BT36 6XA
 \|_/  United Kingdom



Fri, 14 Mar 1997 20:10:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. pty terminal control and IPC via pseudo-terminal devices

2. Terminal problem NEWBIE

3. sample terminal game for newbie

4. newbie question regarding s/<old string>/<new string>/g

5. Newbie: sprintf ('%-20s', 48 char string) returns 48 not 20 length string

6. NEWBIE: Checking a string against another string

7. newbie question about string manipulation

8. Newbie: does an array contain a string

9. Newbie Question on strings

10. Newbie Question: interpretation of strings as variables

11. newbie question on conversion string

12. Help Quick - Easy Newbie String Question

 

 
Powered by phpBB® Forum Software