in reply to Re^2: Why use warnings? -w
in thread Why use warnings? -w
I don't see why you need goto there ;)
#!/usr/local/bin/perl -w use strict; use warnings; use feature qw(say); $SIG{INT} = sub { die q(Nuff said!); }; say q(Did you post some valid code today?); my $answer; while (not defined $answer) { chomp( $answer = <STDIN> ); $answer = lc $answer; my %dispatch = ( 'yes' => sub { say q(Good!) }, 'no' => sub { say q(Bad!) }, 'nada' => sub { say q(Answer yes or no!); undef $answer; } ); ( $dispatch{$answer} || $dispatch{nada} )->(); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Why use warnings? -w
by karlgoethebier (Abbot) on Mar 05, 2018 at 15:25 UTC | |
by alexander_lunev (Pilgrim) on Mar 05, 2018 at 18:31 UTC |