diff prog/06.pl @ 0:520044113ef0 draft

beta release.
author pyon <pyon@macmini>
date Sat, 21 Aug 2021 13:03:13 +0900
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/prog/06.pl	Sat Aug 21 13:03:13 2021 +0900
@@ -0,0 +1,45 @@
+# フラグのテスト
+use utf8;
+my ($text, $city, $kind);   # all
+
+($text, $city, $kind) = ('ほげ', '',       ''      ) if $ARGV[0] == 1; # pattern1
+($text, $city, $kind) = ('ほげ', '仙北市', ''      ) if $ARGV[0] == 2; # pattern2
+($text, $city, $kind) = ('',     '仙北市', '診療所') if $ARGV[0] == 3; # pattern3
+($text, $city, $kind) = ('ほげ', '美郷町', '診療所') if $ARGV[0] == 4; # pattern4
+
+my $n;
+while (<DATA>) {
+    chomp;
+    my @data = split /:/;
+    next if $text ne '' && $data[1] !~ /$text/;
+    next if $city ne '' && $data[2] ne $city;
+    next if $kind ne '' && $data[3] ne $kind;
+    print join ':' => @data;
+    print "\n";
+    $n++;
+}
+print "-- $n matched -- $text && $city && $kind --\n";
+__DATA__
+01:ほげほげ1:大仙市:病院
+02:ほげほげ2:大仙市:病院
+03:ほげほげ3:大仙市:病院
+04:ふがふが1:大仙市:病院
+05:ふがふが2:大仙市:病院
+06:ふがふが3:大仙市:病院
+07:ほげほげ4:大仙市:診療所
+08:ほげほげ5:大仙市:診療所
+09:ほげほげ6:大仙市:診療所
+10:ほげほげ7:大仙市:診療所
+11:ほげほげ8:大仙市:訪問介護
+12:ほげほげ9:大仙市:訪問介護
+13:ほげほげ1:仙北市:病院
+14:ほげほげ2:仙北市:病院
+15:ふがふが1:仙北市:病院
+16:ふがふが2:仙北市:病院
+17:ふがふが3:仙北市:病院
+18:ほげほげ4:仙北市:診療所
+19:ほげほげ7:仙北市:診療所
+20:ほげほげ8:仙北市:訪問介護
+21:ほげほげ9:仙北市:通所介護
+22:ほげほげ1:美郷町:診療所
+23:ほげほげ8:美郷町:訪問介護