返回平面文件db中的记录(行)数? [英] return the number of records (rows) in a flat file db?
问题描述
我想在平面文件db中返回记录(行)的数量。
我的脚本是资源工具包库,每个项目都有一个目录号($ catnumber),而不是用户必须记住在添加记录时要输入的下一个目录号,我希望能够向他们显示下一个号码,或者将其作为表格中字段的值。
我只需要知道如何将数据库中的记录总数(行数?)作为数字返回(加上1 ......这将是他们的下一个目录($ catnumber)数字)
是否与rec_count有关?
我试过:
open(DB,"< / full / path / db / db.txt")|| die无法打开full / path / db / db.txt:$!" ;;
while(< DB>){
($ catnumber)= split (",");
}
但我得到的是他们输入的最后记录的价值($ catnumber)。
>
感谢
I am wanting to return the number of records (rows) in a flat file db.
My script is a resource kit library and each item has a catalog number ($catnumber), instead of the user having to remember the next catalog number to enter as they add a record, I want to be able to either show them the next number or have it as a value in a field on the form.
I just need to know how to return the total number of records (rows?) in the db as a number (plus 1..that would be their next catalog ($catnumber) number)
is it something to do with rec_count?
I tried:
open (DB, "< /full/path/db/db.txt") || die "cannot open full/path/db/db.txt: $!";
while (<DB>) {
($catnumber) = split(",");
}
But what I got was the value ($catnumber) of the LAST record they entered.
thanks
推荐答案
catnumber),而不是用户必须记住下一个目录号码,因为他们添加记录,我希望能够要么向他们显示下一个数字,要么将其作为表格中字段的值。
我只需要知道如何返回记录总数(行?) db作为一个数字(加上1 ..这将是他们的下一个目录(
catnumber), instead of the user having to remember the next catalog number to enter as they add a record, I want to be able to either show them the next number or have it as a value in a field on the form.
I just need to know how to return the total number of records (rows?) in the db as a number (plus 1..that would be their next catalog (
catnumber)号码)
是否与它有关rec_count?
我试过:
open(DB,"< /full/path/db/db.txt")|| die无法打开full / path / db / db.txt:
catnumber) number)
is it something to do with rec_count?
I tried:
open (DB, "< /full/path/db/db.txt") || die "cannot open full/path/db/db.txt:
!" ;;
while(< DB>){
(
!";
while (<DB>) {
(
这篇关于返回平面文件db中的记录(行)数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!