dyno2316 ロヒミフ perl VBA Excel 秀丸

ラベル PerlTips の投稿を表示しています。 すべての投稿を表示
ラベル PerlTips の投稿を表示しています。 すべての投稿を表示

演算子

if ($a ge $b) # 文字列比較 eq ne cmp lt gt le ge
if ($a == $b) # 数値比較  == != <=> < > <= >=
if ( !( $num % 2 == 0 ) ) {
print "奇数です¥n";
}
# AND OR
( ( $x != 7 ) and ( $x > $y ) ); # AND,OR
# 文字列連結
$x = "filename";
$x .= "123"; # filename123
# インクリメント
$a++; # $a=$a+1
# switch文の働き
SWITCH: {
if (/^abc/) { $abc = 1; last SWITCH; }
if (/^def/) { $def = 1; last SWITCH; }
if (/^xyz/) { $xyz = 1; last SWITCH; }
$nothing = 1;
}

期間中の毎日を表示

#----------------------------------------
#☆期間中の日を表示 ppm install date-simple
#----------------------------------------
use Date::Simple;
use strict;
my $day_from = Date::Simple->new(2005, 12, 1);
my $day_to = Date::Simple->new(2006, 2, 28);
my $day_cnt = $day_to - $day_from;
print $day_from," 〜 ",$day_to," = ",$day_cnt, "¥n";
my $day = $day_from;
for (my $i = 0; $i <= $day_cnt; $i++) {
print $i,":",$day->format("%Y/%m/%d"),"¥n";
my $nextday = $day->next;
$day = $nextday;
}