Programming Text String Splitting Issue

  • Please we urge all unregistered users to swiftly register to enable you enjoy loads of benefits rollingout in our community. Be open to opportunities to do good for someone else today. Anything that do not please God in your life has come to distroy you.
banner
Programming related thread

AdServersite

Member
Premium User
Nov 24, 2023
173
0
16
33
Abuja Nigeria

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.
 

BSF For Soul Wining Support Donation

Total amount
$0.00
Goal
$1,000.00
Donation ends: