小编Ell*_*oid的帖子

Perl警告:"发现=有条件的,应该是==",但是线上没有等号

在MacOS 10.7.2上的Perl v5.12.3中运行以下命令:

#!/usr/local/bin/perl

use strict;
use warnings;
use DBI;

my $db = DBI->connect("dbi:SQLite:testdrive.db") or die "Cannot connect: $DBI::errstr";

my @times = ("13:00","14:30","16:00","17:30","19:00","20:30","22:00");

my $counter = 1;

for (my $d = 1; $d < 12; $d++) {
    for (my $t = 0; $t < 7; $t++) {
        #weekend days have 7 slots, weekdays have only 4 (barring second friday)
        if (($d+4) % 7 < 2 || ($t > 3)) {
            $db->do("INSERT INTO tbl_timeslot VALUES ($counter, '$times[$t]', $d);");
            $counter++;
        #add 4:00 …
Run Code Online (Sandbox Code Playgroud)

perl warnings

4
推荐指数
2
解决办法
2324
查看次数

标签 统计

perl ×1

warnings ×1