in reply to A TRUE-once variable

To answer the question you asked, I like the ugly but effective:
my $do = 1; for (0...9) { stuff_to_do_always(); if ($do) { stuff_to_do_first_time(); } else { stuff_to_do_other_times(); } $do = 0; }
I know this isn't too subtle, but I find I can look at it and know what it does.

To answer the question you didn't ask, I think the problem wd go away if you used DBI.pm. Then you could use placeholders, which put the commas in for you (and also handle the quoting issues which you do with quotrim).

This does what (I think) you want:
use DBI; my $dbh = DBI->connect("DBI:mysql:database=chess", "usr", "pwd"); # o +r whatever my @line; my $sth; while (<DATA>) { # your parsing: chomp; next if /^\s*$/; @line = split /;/; # these lines deal with the only variation in # your data I can see - there may be others: if (@line == 3) { push @line, $line[2]; $line[2] = 'NULL'; } # and finally, DBI takes the strain: $sth = $dbh->prepare("INSERT INTO eco_class (eco_id,eco,opening,va +riation,moves) VALUES (NULL,?,?,?,?)") or die $dbh->errstr; $sth->execute(@line) or die $dbh->errstr; }


§ George Sherston