in reply to Use of uninitialized value $data

As pretty much everyone else has said now the problem is in your data - the stuff you are not showing us. See How to ask better questions using Test::More and sample data for rationale and instructions to produce an SSCCE like this one.

use strict; use warnings; use Test::More tests => 1; use Test::NoWarnings; my $line = 'foo=a,bar=3,baz=Fizzlegrapplebaum'; my @data = split(',', $line); foreach my $datapair (@data) { my ($label, $data) = split('=', $datapair); my $out = "label: $label; data: $data\n"; }

Of course, here the test succeeds because the initial data is good. Your task is to make this test (or one very similar to it) fail by supplying the duff value for $line.