Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- # save this file utf8
- use strict;
- use warnings;
- use utf8;
- use Encode;
- use CGI;
- my $q = CGI->new;
- my $file = 'bel.csv';
- open my $csv, '<:encoding(euc-jp)', $file or die;
- my $search = decode_utf8 $q->param('KENSAKU');
- my @match = ();
- while (<$csv>) {
- chomp;
- my @d = split ',';
- push @match, \@d if $d[0] eq $search;
- }
- my @td = ();
- for (@match) { push @td, $q->td([$_->[1], $_->[2], $_->[3]]) }
- print $q->header( -charset => 'UTF-8' ),
- $q->start_html( -title => '番号検索' ),
- $q->h3($search . ' 該当: ' . @match . '名'),
- $q->table( { -border => 1 },
- $q->Tr($q->th(['所属部署', '名前', '番号'])),
- $q->Tr(\@td)
- ),
- $q->end_html;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement