Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ignore carriage returns from STDIN.

Status
Not open for further replies.

newtarge

ISP
Oct 27, 2003
21
US
Please tell me how to do this. here is an example of the current part of the script i'm working with. If I paste a small paragraph from note pad in windows it chops at the 1st carriage return. How do I make SDTIN accept the whole paragraph?

print "What will the subject be[]?";
$subject = <STDIN>;
chomp ($subject);
print &quot;paste your message here[]&quot;;
$message = <STDIN>;
chomp ($message);
print &quot;$message\n&quot;;
open (TEXT,&quot;>$b3&quot;);
print TEXT &quot;Subject: $subject\n\n&quot;;
print TEXT &quot;$message\n&quot;;
close (TEXT);
 
Or you can change

$message = <STDIN>

to

@message = <STDIN>

Each carriage return will place the previously typed text into a new array element. Input will not stop being recieved until the user types ctrl+z (windows) or ctrl+d (linux)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top