Skip to content

Instantly share code, notes, and snippets.

@mamemomonga
Last active August 26, 2023 23:05
Show Gist options
  • Save mamemomonga/921bfaf37e325125ad8887d8a684e5aa to your computer and use it in GitHub Desktop.
Save mamemomonga/921bfaf37e325125ad8887d8a684e5aa to your computer and use it in GitHub Desktop.
今日の星占い
#!/usr/bin/env perl
use strict;
use warnings;
use feature 'say';
use utf8;
binmode(STDIN, ":utf8");
binmode(STDOUT,":utf8");
binmode(STDERR,":utf8");
my $uranai_data;
{ local $/; $uranai_data=<DATA> }
my @uranai=split("\n",$uranai_data);
my @conste=(
"牡羊座",
"牡牛座",
"双子座",
"蟹座 ",
"獅子座",
"乙女座",
"天秤座",
"蠍座 ",
"射手座",
"山羊座",
"水瓶座",
"魚座 ",
);
sub jst {
my $time=shift;
$ENV{'TZ'} = "JST-9";
my @wdays = qw(日 月 火 水 木 金 土);
my ($sec, $min, $hour, $mday, $mon, $year, $wday) = localtime($time);
sprintf("%d月%d日(%s曜日)", $mon+1, $mday, $wdays[$wday]);
}
{
my $ctn=($#uranai)-($#conste);
if($ctn<0) {
say "占い項目が ".($ctn*-1)." 個足りません";
exit(1);
}
}
my @uranair=();
{
my %uh;
foreach(@uranai) { $uh{rand(100)}=$_ }
foreach(sort keys %uh) { push @uranair,$uh{$_}}
}
say jst(time)." "."今日の星占い";
for(my $i=0;$i<=$#conste;$i++) {
printf(" %s: %s\n",$conste[$i], $uranair[$i])
}
__DATA__
メモリースティック
メモリースティックDuo
メモリースティックPro Duo
メモリースティックPro-HG Duo
メモリースティックXC Duo
メモリースティックXC-HG Duo
マルチメディアカード
SDカード
SDHCカード
SDXCカード
miniSDカード
miniSDHCカード
microSDカード
microSDHCカード
microSDXCカード
スマートメディア
xDピクチャーカード
コンパクトフラッシュ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment