Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6358513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:23:24+00:00 2026-05-24T23:23:24+00:00

I am testing perl script using this example found on the forum. I took

  • 0

I am testing perl script using this example found on the forum. I took the sample data and put it in a separate file and using an open to try it this way.

I don’t understand why I would be getting undef. I am getting the msg:

Use of uninitialized value in join or string at ./h.pl line 15, line 4.

#!/usr/local/bin/perl

use warnings;
use strict;
use Data::Dumper;
use Text::CSV_XS;

    open my $fh, '<', 't.out' or die "Unable to open: $!";
    my $csv = Text::CSV_XS->new( { sep_char => "\t" } );
    my @list;
    $csv->column_names ($csv->getline ($fh));
    while ( my $hr = $csv->getline_hr($fh) ) {
        push @list, $hr->{'Ball'};
    }

    print "@list\n";
    print Dumper(\@list);

Test file (t.out)

Camera Make Camera Model    Text    Ball    Swing
a   b   c   d   e
f   g   h   i   j
k   l   m   n   o


$ od -cx t.out 
0000000   C   a   m   e   r   a       M   a   k   e  \t   C   a   m   e
        6143 656d 6172 4d20 6b61 0965 6143 656d
0000020   r   a       M   o   d   e   l  \t   T   e   x   t  \t   B   a
        6172 4d20 646f 6c65 5409 7865 0974 6142
0000040   l   l  \t   S   w   i   n   g  \n   a  \t   b  \t   c  \t   d
        6c6c 5309 6977 676e 610a 6209 6309 6409
0000060  \t   e  \n   f  \t   g  \t   h  \t   i  \t   j  \n   k  \t   l
        6509 660a 6709 6809 6909 6a09 6b0a 6c09
0000100  \t   m  \t   n  \t   o  \n  \0
        6d09 6e09 6f09 000a
0000107

Results:

$VAR1 = [
          undef,
          undef,
          undef
        ];
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T23:23:25+00:00Added an answer on May 24, 2026 at 11:23 pm

    In the question you refer to, I also wrote this on the last line:

    ETA: If you’re going to cut & paste to try it out, make sure that the
    tabs are carried over in the data.

    Did you make sure that your tabs survived the copy/paste into your file 't.out'?

    This module is rather unforgiving about bad formats in the data file.

    Update:

    Be aware that a field such as 'Ball ' will be considered different than 'Ball'. I.e. if you have additional whitespace, it will screw things up.

    What you may try out to correct that is adding allow_whitespace => 1, to the options of the $csv object. This will correct any subtle whitespace errors in your input file.

    You can also check for format errors by printing the header keys with

    print Dumper $csv->column_names(); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I run my perl CGI script without apache? This is for testing
I use Test::Unit::Lite for unit testing in Perl. Now, this module looks for .pm
I'm a Perl programmer doing some web application testing using Selenium . I was
G'day, I was using Test::Class perl module for some testing recently and ran into
I'm building a regression system ( not unit testing) for some Perl scripts. A
I am creating an automated testing framework in Perl for regression tests. I would
For testing purposes I have to generate a file of a certain size (to
When you run perl -e "Bla->new" , you get this well-known error: Can't locate
I have a Moose class that i would like to store using Apache::Session::File. However,
I'm trying to write a Perl script that will work better with KDE's kwrited

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.