in reply to While(defined(STDIN)) does not break
It returns the total number of characters removed from all its arguments.chomp will always return a defined value.
A better way to do what you want is:
Or have a look at Prompt::ReadKey.use strict; use warnings; use feature qw/say/; my @input; while (<>) { chomp; last unless $_; say "Your entry was: $_"; push @input, $_; }
CountZero
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
|
|---|