From 0642bddf02e4e2a47f236fe7a608290bc4c9b680 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C5=82awomir=20Nizio?= Date: Sat, 29 Nov 2014 20:22:12 +0100 Subject: [PATCH] [modify.pl] switch away from smart match and given --- modify.pl | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/modify.pl b/modify.pl index 9c9f6ab..b447b11 100755 --- a/modify.pl +++ b/modify.pl @@ -159,25 +159,25 @@ else { say "OK to proceed? [y/n]"; while (my $inp = ) { chomp $inp; - given (lc($inp)) { - when ('y') { - unless (rename $tmp_file, $file) { - warn "moving file failed: $!\n"; - exit 1; - } - say "Wrote to $file."; - unlink $lock_file or warn "removing lock file failed: $!\n"; - exit 0; - } - when ('n') { - say "Okay, not saving changes."; - unlink $tmp_file or warn "removing temp. file failed: $!\n"; - unlink $lock_file or warn "removing lock file failed: $!\n"; - exit 0; - } - default { - say "I don't can not understand the answer!"; + my $lc_inp = lc $inp; + + if ($lc_inp eq 'y') { + unless (rename $tmp_file, $file) { + warn "moving file failed: $!\n"; + exit 1; } + say "Wrote to $file."; + unlink $lock_file or warn "removing lock file failed: $!\n"; + exit 0; + } + elsif ($lc_inp eq 'n') { + say "Okay, not saving changes."; + unlink $tmp_file or warn "removing temp. file failed: $!\n"; + unlink $lock_file or warn "removing lock file failed: $!\n"; + exit 0; + } + else { + say "I don't can not understand the answer!"; } } } @@ -277,7 +277,7 @@ sub search_dups { my $stop_at_first = shift; my @ret = (); for (0..$#section_strings) { - if ($section_strings[$_] ~~ [ $text, $text_c ]) { + if ($section_strings[$_] eq $text or $section_strings[$_] eq $text_c) { push @ret, $_; last if $stop_at_first; }