Reputation: 31
I am getting Input data from user by using
$input=<>;
But when type Enter it won't go next process it accept Enter character also but only go when type ^z
but i want go next process when press Enter.
Upvotes: 0
Views: 616
Reputation: 67910
The code you have presented in itself does not do what you say it does. It simply reads one line and then moves on. In scalar context, the readline()
function (for which using angle brackets <>
is a shortcut) is an iterator, and reads one line at the time until the file handle is exhausted (it reaches end of file).
There are two things that may account for this behaviour:
$/
so that it no longer takes newline to denote end of line,@input = <>;
# or
($input) = <>;
In the first case, it will read until it finds the input record separator and return that (multiline) string to be assigned to the $input
variable. You can terminate it prematurely by pressing sending end of file: Ctrl-Z in windows, or Ctrl-D in *nix.
In the second case, the readline()
is in list context, and will read until it finds end of file, which is the thing discussed above.
Upvotes: 4