-----Original Message-----
>From: [EMAIL PROTECTED]
>
>Please look at my short code and tell me where I go wrong.
>I though a read from STDIO should make the execution stop,
>wait for some input and a return, but my code just continues.
>
>sub user_choice {
>  (my $list) = @_;
>
>  # Some foreach functionality on the list items ...
>  print "Give me a command:\n";
>  my $command = <STDIN>;  # Shouldn't it stop here and wait for input???
>  chop $command; # this gives "Use of uninitialized value in scalar chop at 
> ./script.pl line 70."
>
>  # The script just continues???
>}
>

Don't know where you are getting wrong.
The code works fine for me:

use strict;
use warnings;

user_choice();

sub user_choice {
  print "Give me a command: ";
  my $command = <STDIN>;
  chomp $command;
  print $command;
}

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


Reply via email to