Perl text database file help needed
I have the following in a text file:::10::: Changing Shell to /bin/false...Changing shell for newdsm2.
Shell not changed.
Done
Locking Password...Changing password for user newdsm2
Locking password for user newdsm2
passwd: Success
Done
send to CONTACTEMAIL (3) [3]
Account Already Suspended
:::The account was already suspended::: :::Failed:::
---------------------------------------------------
:::11::: Changing Shell to /bin/false...Changing shell for mixbree.
Shell not changed.
Done
Locking Password...Changing password for user mixbree
Locking password for user mixbree
passwd: Success
Done
send to CONTACTEMAIL (3) [3]
Account Already Suspended
:::The account was already suspended::: :::Failed:::
---------------------------------------------------
it is two entries separated by ---------------------------------------------------. I'm trying to get the perl script to open the file read it in and then for each of the entries go through and get the variable values between :::$var1:::
example of what I've done:
open(INFO, "<text.txt");
@line = <INFO>;
close(INFO);
#get each line from that file and place it into a variable
$long_line = join("\n", @line) ;
@firstarray = split(/---------------------------------------------------/,$long_line);
$t=0;
foreach $firstarray (@firstarray) {
@received = split(/:::/,$firstarray,/:::/);
$cmdid=$received[$t+1];
$comments=$received[$t+3];
$status=$received[$t+5];
$t++;
}
where am I going wrong can anyone provide some assistance?