How can my Perl code catch Ctrl+D? -
chomp($input = <>); how know whether $input ctrl+d?
you know have reached eof when undef <>, in case chomp hiddening it.
the usual perl idiom read until eof follows:
while(<>) { chomp; # whatever want line in $_ # ... }
Comments
Post a Comment