Reputation: 28602
I'm very new to Perl and currently I'm learning it on Windows 7 with ActiveState Perl. This is my program.
chomp(my @lines = <STDIN>);
foreach (sort @lines) {
print $_;
}
When running the program, I type some lines of strings then press Ctrl + c to tell the program that I've finished typing. However, after I get my result (generated from print $_;
), I also got this message: Terminating on signal SIGINT(2). How to disable this message?
Thanks.
Upvotes: 2
Views: 711
Reputation: 68
You can handle signals like that:
$SIG{INT} = sub { print("Caught SIGINT but continue!\n"); };
for a keyboard interrupt. It's an exemple.
Upvotes: 1
Reputation: 33380
For Windows, to signify End of Line press Ctrl + Z
followed by Enter
Pressing Ctrl + C
sends the interrupt signal to your program which is the cause of the Terminating on SIGINT
message you are seeing.
Upvotes: 4