Hello everyone, I use the following to split a comma delimited list and get varying results and I don't understand why.
my count of the elements in the splitdata array returns 43 but the select list when displayed in our Content management system only has approximately 23 items. Some items are compltely ignored. The comma delimited txt file is below. About You,BCS Employee,Sales Recognition Events Framework,BPFJ+,Building Wealth,Community Program,Compensation,Employment Confirmations,Employee Development,Employee Services,Executive Development,Expense Reimbursement,Financial Benefits,Flexibility,Global Pulse Survey,Health Benefits,Hiring,HR Assist,IDP Tool,Insurance,Manager Services,Management Development,Mobility,New Hire Information,Other,PaylinkPlus,Payroll Services,PBC Tool - Urgent,PBC Tool - Normal,Peace of Mind Benefits,Personnel Records,Promotions,Reporting,Reporting - Data Quality & Integrity,Site Utilities,Single Cycle Salary Review,Transition Employees,Transactional,Well Being,When Life Changes,Workforce Diversity,Workplace Practices,Your Career #!/usr/bin/perl my $fileToOpen = shift; # $string = qq[<option value="$fileToOpen" label="$fileToOpen"/>]; open( FILEHANDLE, $fileToOpen ) or die ("Could not open file $fileToOpen"); while( my $line = <FILEHANDLE> ){ chomp $line; $inFile .= $line; } close(FILEHANDLE); my @splitData = split( /\,/, $inFile ); $numElements = scalar(@splitData); $optionHTML = qq[<option label="$numElements:" />]; foreach $subject(@splitData){ $subject =~ s/&/&/g; $subject =~ s/\"/"/g; $optionHTML .= qq[<option label="$subject" />]; } # produce output print <<EOF; <?xml version="1.0" encoding='UTF-8'?> <substitution> $optionHTML </substitution> EOF #