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 248699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T21:21:54+00:00 2026-05-11T21:21:54+00:00

Closing this question. Will drink red bull. Sleep. Code and come back with brand

  • 0

Closing this question. Will drink red bull. Sleep. Code and come back with brand spanking new question with unit test cases.

UPDATE: The new file is here

Also the config file is here

I refactored the code again:

sub getColumns {
    open my $input, '<', $ETLSplitter::configFile
        or die "Error opening '$ETLSpliter::configFile': $!";

    my $cols;
    while( my $conline = <$input> ) {
        chomp $conline;
        my @values = split (/=>/, $conline);
        if ($ETLSplitter::name =~ $values[0] ) {
            $cols = $values[1];
            last;
        }
    }

    if($cols) {
        @ETLSplitter::columns = split (':', $cols);
    }
    else {
        die("$ETLSplitter::name is not specified in the config file");
    }
}

This code always dies here die("$ETLSplitter::name is not specified in the config file");.

Another clue is that if I change split (':', $cols); to split (/:/, $cols); I get this error.

 perl -wle "
 use modules::ETLSplitter;
 \$test = ETLSplitter->new('cpr_operator_metric_actual_d2', 'frame/');
 \$test->prepareCSV();"
 syntax error at modules/ETLSplitter.pm line 154, near "}continue"
 Compilation failed in require at -e line 2.
 BEGIN failed--compilation aborted at -e line 2.
  • 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-11T21:21:54+00:00Added an answer on May 11, 2026 at 9:21 pm

    FINAL POST FOR THIS QUESTION: Based on your latest updates, I believe the following code illustrates how there is no problem with using /:/ as the first argument to split. It also points out that it is easier to read code when one uses arguments to functions rather than relying on global variables:

    #!/usr/bin/perl
    
    use strict;
    use warnings;
    
    use Data::Dumper;
    
    for my $varname ( qw( adntopr.cpr.smtref.actv cpr_operator_detail )) {
        print $varname, "\n";
        print Dumper get_columns(\*DATA, $varname);
    }
    
    sub get_columns {
        my ($input_fh, $varname) = @_;
    
        while ( my $line = <$input_fh> ) {
            chomp $line;
            my @values = split /=>/, $line;
            next unless $varname eq $values[0];
            return [ split /:/, $values[1] ];
        }
        return;
    }
    
    __DATA__
    adntopr.cpr.smtref.actv=>3:8:18:29:34:38:46:51:53:149
    adntopr.smtsale2=>3:8:16:22:27:37:39:47:52:57:62:82:102:120:138:234:239:244:249:250:259:262:277:282:287:289:304:319:327:331:335:339:340:341:342:353:364:375:386:397:408
    cpr_operator_detail=>3:11:18:28:124:220:228:324
    cpr_operator_org_unit_map=>7:12
    cpr_operator_metric_actual=>8:15:25:33:38:40:51
    
    C:\Temp> tjm
    adntopr.cpr.smtref.actv
    $VAR1 = [
              '3',
              '8',
              '18',
              '29',
              '34',
              '38',
              '46',
              '51',
              '53',
              '149'
            ];
    cpr_operator_detail
    $VAR1 = [
              '3',
              '11',
              '18',
              '28',
              '124',
              '220',
              '228',
              '324'
            ];
    

    There is a lot of cruft in that code. Here is my interpretation of what you are trying to do:

    UPDATE: Given your recent remark about regex special characters in patterns, if you are going to use them in the pattern to split, make sure to quote them. There is also a chance that $ETLSpliter::name might contain other special characters. I modified the code to deal with that possibility.

    sub getColumns {
        open my $input, '<', $ETLSpliter::configFile
              or die "Error opening '$ETLSpliter::configFile': $!");
          my @columns;
          while( my $conline = <$input> ) {
              my @values = split /=>/, $conline;
              print "not at: ".$conline;
              push @columns, $values[1] if $values[0] =~ /\Q$ETLSpliter::name/;
          }
          return @columns;
      }
    

    ANOTHER UPDATE:

    So, the pattern indeed is /=>/ based on your comment below. Then:

    my $conline = q{cpr_operator_detail=>3:11:18:28:124:220:228:324};
    my @values = split /=>/, $conline;
    
    use Data::Dumper;
    print Dumper \@values;
    __END__
    
    C:\Temp> tml
    $VAR1 = [
              'cpr_operator_detail',
              '3:11:18:28:124:220:228:324'
            ];
    

    No errors … No warnings Therefore, there is something else that is going on which you insist on not showing us.

    Other Remarks:

    1. Use lexical filehandles and let perl tell you what errors it may encounter rather than presuming.

    2. Declare variables in the smallest applicable scope.

    3. No need to assign $_ to $conline in the body of the loop when you can do that in the while statement.

    4. In the original code, you were not putting anything in @columns or doing anything useful with $colData.

    5. Tone down the rhetoric. Computers work on the principle of GIGO.

    6. Looking at the code at the link you posted, it looks like you are not aware that you can do:

      use File::Spec::Functions qw( catfile );
      ...
      catfile($ETLSpliter::filepath_results, $ETLSpliter::actual_name);
      

    Further, it looks like you are using a package where hash would have done the job:

    $ETLSpliter{filepath}
    

    Finally, you do realize Spliter is incorrect. ITYM: Splitter.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 124k
  • Answers 124k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Note that the video is from 2005, and most of… May 12, 2026 at 1:14 am
  • Editorial Team
    Editorial Team added an answer You can see Flash's cached data using the Website Storage… May 12, 2026 at 1:14 am
  • Editorial Team
    Editorial Team added an answer You can use OnItemDataBount event and work with DataItem as… May 12, 2026 at 1:14 am

Related Questions

A precompiled ASP.NET 2.0 (Visual Studio 2005) application is throwing this error when we
This question is about a Java JTree or a Window .Net Tree (Winforms) or
Note: This question and most of its answers date to before the release of
We are using CheckStyle to enforce our style standards. One of the style rules

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.