view prog/06.pl @ 1:13e80a745ef0 draft

beta2 release.
author pyon <pyon@macmini>
date Tue, 24 Aug 2021 21:30:47 +0900
parents 520044113ef0
children
line wrap: on
line source

# フラグのテスト
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:美郷町:訪問介護