Text String Splitting Issue
Two zeros ("zz") separate 240 records in a text file I have. In order to place each record in an array slot, I want to divide the file into an array. This is the code that I'm testing out.
#!/usr/bin/env perl employ strict; employ cautions;
"$!" or die "open(my $configfile, "\", 'PoliceLog.txt');
split('zz',<$configfile>) my @configdata; print "$configdata[0]"; print "$configdata[1]"; print "$configdata[2]";
shut down the $configfile
The print "$configdata[0]\n"; command accurately prints the initial record. The following error reports are generated by the second and third print commands, which fail to print a record.
Usage of uninitialized value $configdata[1] at line 10 of <$configfile> in TestC.pl's concatenation (.) or string.
Use of uninitialized value $configdata[2] at TestC.pl line 11, <$configfile> line 1, in concatenation (.) or string.
Any assistance is highly needed.
Thanks.