On 06/03/2007 01:23 AM, Ryan wrote:
Hello. This is my first post to the List. I am just getting my feet wet with perl, my first programming language.


Welcome to the list Ryan.

I'm running perl 5.8.4 on Libranet linux, a now-defunct distro based on out-of-date Debian (Sarge or before, I think).

I am having trouble inputting a value via <STDIN>.

Here is my troublesome script:

#!usr/bin/perl

use strict;

open F, "JunkTestText.txt";
local $/ = "\*\*\*";

You set the input record separator to "\*\*\*", and since the "*" character does not change meaning when backslash-escaped, the backslashes are ignored, so the string is the same as "***"


my @sections = <F>;
close F;

print @sections;
print "\n\n ------------end of echo check--------- \n\n";

my $patient="";

print "Which patient are you looking for?\n";
chomp($patient = <STDIN>);
print "you are looking for $patient\n";

When executed, it runs up to and including asking me for input from the terminal. When I enter a value for $patient (a 7-digit number) and press enter, nothing happens. The cursor goes down to the next line and just waits.

If I replace the whole STDIN thing with a fixed value for $patient, the script runs fine.

Appreciate any advice.

--Chris


Since "***" is the record separator, you have to enter "***" to get the program to continue.

Read "perldoc perlvar" on how to use $/ again.

I hope this helps.




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to