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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:01:35+00:00 2026-05-23T06:01:35+00:00

I have a nice progress indicator from Need a progress indicator for a Perl

  • 0

I have a nice progress indicator from Need a progress indicator for a Perl system() command using T:R:G mod

open(my $cmd, '-|', "$command $flags_args 2>/dev/null")
  or print "\nAttention: Command $command $flags_args failed $!"
  and return 1;

while (<$cmd>)
{
  $percentage = ($cntr/$lines) * 100;
  $percentage = 100 if $percentage > 100;

  printf("Progress: %3d%%\r", $percentage);
  $cntr++;

}
close($cmd);

Now my I want logging of the STDOUT and STDERR of the commands output. I’m not too familiar with pipe output so I tried adding:

print $LOG $cmd

and

print $LOG Dumper(\$cmd)

before the end of the while loop. It did not work. The first output

GLOB(0x11df7a0)GLOB(0x11df7a0)GLOB(0x11df7a0)

the second

$VAR1 = \\*{'::$cmd'};
$VAR1 = \\*{'::$cmd'};
$VAR1 = \\*{'::$cmd'};

Does anyone know how I can get the output from the piped $cmd?
Example for a $command = make command

 Making all in src
 make[1]: Entering directory `/tmp' 
 Making all in include
 make[2]: Entering directory '/tmp/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-23T06:01:35+00:00Added an answer on May 23, 2026 at 6:01 am

    Try making it

     print $LOG $_;
    

    or maybe just

     print $LOG;
    

    (since $_ is the default if nothing is specified)

    To explain: $cmd is the file you’re reading from; $_ is the line read from it. You can make it clearer by writing:

     while ($line = <$cmd>) {
        print $LOG $line;
        ...
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a nice page that does everything I need. However one of the
Say I have a nice domain model, using (constructor) DI where needed. Now I
I'm creating a little Java application which should have a progress indicator with percentages.
I have a nice and lovely Django site up and running, but have noticed
I have a nice DataGridView showing what is basically some kind of log data
I have this nice little MSBuild-based daily build setup that I use on my
I have a nice interface, and I want to implement one member of it
Does anyone have a nice solution for GalleryView when I want to display photos
So I have this nice spiffy MVC-architected application in Java Swing, and now I
Imagine that I have a nice Deck class, in the best OO fashion. It

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.