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

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -