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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:24:58+00:00 2026-05-24T18:24:58+00:00

I have an output file that is \t delimited: Data for 08/10/2011 Host QueueName

  • 0

I have an output file that is \t delimited:

Data for 08/10/2011 
Host    QueueName   Queue-id    
test    123 Test Q  110
test    456 Test Q  120
test    789 Test Q  130

I’m looking to remove the first line (date) and then I want the 2nd line (header columns) to
print out with the values like so as my final output file:

Host=test QueueName=123 Test Q Queue-id=110
Host=test QueueName=456 Test Q Queue-id=120
Host=test QueueName=789 Test Q Queue-id=130

What is a good way/practice to do this in perl?

  • 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-24T18:25:00+00:00Added an answer on May 24, 2026 at 6:25 pm

    I would recommend Text::CSV_XS for reading the file.

    In this recent question, there was a similar problem: How can I use Perl extract a particular column from a tab-separated file? (See my answer)

    use warnings;
    use strict;
    use Text::CSV_XS;
    use autodie;
    
    my $csv = Text::CSV_XS->new( { sep_char => "\t" } );
    <DATA>;  # discard the first line
    $csv->column_names ($csv->getline (*DATA));
    my $hr = $csv->getline_hr_all(*DATA); 
    
    for my $hashref (@$hr) {
        my @list;
        for my $key ($csv->column_names()) {
            push @list, join '=', $key, $hashref->{$key};
        }
        print "@list\n";
    }
    __DATA__
    Data for 08/10/2011 
    Host    QueueName   Queue-id    
    test    123 Test Q  110
    test    456 Test Q  120
    test    789 Test Q  130
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a perl program that takes input and output file arguments, and I'd
I have a SQL procedure that generates a util file as its output depending
If i have a php file that outputs json data with numerical keys, like
I have a tab delimited file that I am trying to convert to a
I have a text file that is in a comma separated format, delimited by
I have a .dat file that is essentially ; delimited file and I'm trying
I have the following script that parses some | delimited field/value pairs. Sample data
I have a file containing the data shown below. The first comma-delimited field may
Suppose I have a tab delimited file containing user activity data formatted like this:
The problem I have a tab delimited input file that looks like so: Variable

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.