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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:12:40+00:00 2026-05-29T08:12:40+00:00

I am doing a pipeline delimited report using perl. How do i include the

  • 0

I am doing a pipeline delimited report using perl. How do i include the delimiting character | between the fields. | symbol in perl stands for aligning the field to centre.

format details =
@<<<<<<<<<<<<  @<<<<<<<<<<<<<<<<<<<<<<<  @<<<<<<<<<<<<
"$rtype", "$rdescr", "$rid"

OUTFILE->format_name("details");
write OUTFILE;
  • 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-29T08:12:41+00:00Added an answer on May 29, 2026 at 8:12 am

    If you’re using that format, then you could as simply use:

    print OUTFILE "$rtype|$rdescr|$rid\n";
    

    You should think about migrating to lexical file handles though ISTR that formats require the non-lexical handles. However, that doesn’t automatically truncate the fields to length, which may matter to you.

    This code works for me:

    #!/usr/bin/env perl
    use strict;
    use warnings;
    
    open OUTFILE, ">", "file.out" or die "A horrible death";
    
    my $rtype = "ABCDEFG HIJKLMN OPQRST";
    my $rdescr = "Abc def ghi jkl mno pqr stuv wxyz?";
    my $rid   = "0123456789";
    
    format details =
    @<<<<<<<<<<<< | @<<<<<<<<<<<<<<<<<<<<<<< | @<<<<<<<<<<<< |
    "$rtype", "$rdescr", "$rid"
    .
    
    OUTFILE->format_name("details");
    write OUTFILE;
    
    
    $rtype = "ABCDEFG";
    $rdescr = "Abc def";
    $rid   = "01234";
    write OUTFILE;
    

    The output it produces (in file.out) is:

    ABCDEFG HIJKL | Abc def ghi jkl mno pqr  | 0123456789    |
    ABCDEFG       | Abc def                  | 01234         |
    

    (PS: I tried \| first; it produced \| in the output, so it was an easy and reasonable inference that the backslash was not actually needed.)

    With lexical file handle:

    #!/usr/bin/env perl
    use strict;
    use warnings;
    
    open my $out, ">", "file.out" or die "A horrible death";
    
    my $rtype = "ABCDEFG HIJKLMN OPQRST";
    my $rdescr = "Abc def ghi jkl mno pqr stuv wxyz?";
    my $rid   = "0123456789";
    
    format details =
    @<<<<<<<<<<<< | @<<<<<<<<<<<<<<<<<<<<<<< | @<<<<<<<<<<<< |
    "$rtype", "$rdescr", "$rid"
    .
    
    $out->format_name("details");
    write $out;
    
    
    $rtype = "ABCDEFG";
    $rdescr = "Abc def";
    $rid   = "01234";
    write $out;
    

    This gives the same output.

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

Sidebar

Related Questions

I've been doing graphic programming using the fixed pipeline of OpenGL after learning in
I'm using the assets pipeline from Rails 3.1 and I want to include some
Doing an ajax get request works as expected using the following code: $.ajax({ type:
I'm just getting into the Asset Pipeline; I'm using SASS/SCSS, but I'm not understanding
I am using Context.RewritePath() in ASP.NET 3.5 application running on IIS7. I am doing
Using the Fixed Function rendering pipeline in DirectX 9, it's quite easy to set
Currently, I'm using the RX Framework to implement a workflow-like message handling pipeline. Essentially
I am doing a research project that involves a pipeline of programs, each generating
Doing odd/even styling with jQuery is pretty easy: $(function() { $(.oddeven tbody tr:odd).addClass(odd); $(.oddeven
Doing my first SL4 MVVM RIA based application and i ran into the following

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.