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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:12:51+00:00 2026-06-14T04:12:51+00:00

In my script I check for the existence of elements compared to a set

  • 0

In my script I check for the existence of elements compared to a set of data that I already have, I do this multiple time, hence the progress bar.

This is what I am doing as of now

### A loop which is done multiple times ### 

my $i =1;
my $page = 50;
while ($i <= $page)    
{

##### Part where I print my progress bar ######
print "\rProgress:[";
my $completed =($i/$page)*100;
$completed = ceil($completed);
my $l= $completed;
while ($l>0){
    print "#";
    $l--;
}   
my $remaining = 100-$completed;
while ($remaining>0){
    print " ";
    $m--;
} 
print "] ";
print $completed . "% Complete";


######### Part where I check and keep count #############
foreach (@each_job) 
{
    my $temp = $_;
    # Count number of jobs that exist with my set
    if ($job{"$temp"} == 1) 
    { 
        $does_exist++ ;
        ## print "\n Exists - $does_exist"; #Confused for this print
    }
    else 
    {
        $does_not_exist++;
        ## print "\n Does not exist - $does_not_exist"; #Confused for this print
    };
    };
    $i++;
}

So what I currently get is something like

Progress:[################################################                                                    ] 48% Complete

Which works fine and displays the progress bar as a traverse page by page.
But what I want is something like this –

Progress:[################################################                                                    ] 48% Complete
Exists - 3
Does Not Exist - 5

Which keeps getting updated at the same spot (using \r).
Can someone help me ?

  • 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-06-14T04:12:52+00:00Added an answer on June 14, 2026 at 4:12 am

    Use a curses library which handles all the escape code rigamarole for you, and lets you get down to just updating regions of the screen.

    Start with this CPAN search for curses modules.

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

Sidebar

Related Questions

I already have a script that check for the cookies existence, but i need
I have a php script that check if the referrer has been cleared after
So i have a simple form with a script to check the data before
I have a script that pulls files from a FTP directory on a set
I'm writing a Powershell script that will extract a set of data files from
I have to check for the existence of several tables from a shell script,
I have a SQL script that has to be run every time a client
In a bash script, I have to check for the existence of several files.
I have a python daemon process that gets started via rc.local. This same script,
I have a simple script to check how many files a user has uploaded:

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.