Hey all.
I have my script open a database. It grabs the information from a database with the script below.
open (ORGDB,"<$mainfile2"
@ODB=<ORGDB>;
close (ORGDB);
foreach $rec (@ODB){
chomp($rec);
($tid,$tinformation)=split(/\|/,$rec);
if ($id eq $tid) {
$information = $tinformation;
}
}
the database looks like this:
1|Player,POS,G,AB,R,H,2B,3B,HR,RBI,TB,BB,SO,SB,CS,OBP,SLG,AVG
2|Hello,test,what,is,up
if $id is 1 then $information becomes Player,POS,G,AB,R,H,2B,3B,HR,RBI,TB,BB,SO,SB,CS,OBP,SLG,AVG
now I need to know how to split each of them and make it so $1 = Player
$2 = POS
$3 = G
etc.
but will do it for each one. The thing is though is if say $id is 2 then there are only 5 so there would just be $1 - $5 and for id 1 it would be $1 - $18. I need the script to keep making it like that. Next, I need another script that will count how many there are and make a variable $total be what that number is for example id 1 would make 18. Thanks.
I have my script open a database. It grabs the information from a database with the script below.
open (ORGDB,"<$mainfile2"
@ODB=<ORGDB>;
close (ORGDB);
foreach $rec (@ODB){
chomp($rec);
($tid,$tinformation)=split(/\|/,$rec);
if ($id eq $tid) {
$information = $tinformation;
}
}
the database looks like this:
1|Player,POS,G,AB,R,H,2B,3B,HR,RBI,TB,BB,SO,SB,CS,OBP,SLG,AVG
2|Hello,test,what,is,up
if $id is 1 then $information becomes Player,POS,G,AB,R,H,2B,3B,HR,RBI,TB,BB,SO,SB,CS,OBP,SLG,AVG
now I need to know how to split each of them and make it so $1 = Player
$2 = POS
$3 = G
etc.
but will do it for each one. The thing is though is if say $id is 2 then there are only 5 so there would just be $1 - $5 and for id 1 it would be $1 - $18. I need the script to keep making it like that. Next, I need another script that will count how many there are and make a variable $total be what that number is for example id 1 would make 18. Thanks.