Just some minor changes to allow no input to terminate your processing. This
will terminate when only enter is depressed.
#!perl -w
my $i=-1;
my @value = ();
do{
chomp($value[++$i] = <STDIN>);
}until (! $value[$i]);
# print the input
foreach ( @value ) {
print "$_\n";
}
Wags ;)
-----Original Message-----
From: Jason Cruces [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 02, 2001 14:13
To: [EMAIL PROTECTED]
Subject: terminating input
Hello all,
Probably are really simple one but haven't found the
answer yet. In an interactive program, where a user is
prompted to enter more than one value, I would use
chomp(@values = <STDIN>);
And to terminate the input, enter Ctrl-D (or Ctrl-Z on
windows).
My question is, how would I change the terminating
characters (Ctrl-D) to the user just hitting the enter
key (or any other character)?
I tried a do/until statement like
do{
$i=0;
chomp($value[$i] = <STDIN>).
$i++;
}until (! $value[$i]);
but still not having much luck. Any ideas?
Thanks in advance.
__________________________________________________
Do You Yahoo!?
Find a job, post your resume.
http://careers.yahoo.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]