Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Use of uninitialized value $data

by hippo (Bishop)
on Nov 14, 2018 at 09:28 UTC ( [id://1225773]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1225773]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-04-20 01:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found