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

  • Home
  • SEARCH
  • 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 8288103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:12:41+00:00 2026-06-08T12:12:41+00:00

just have a general question that came up while I was playing around with

  • 0

just have a general question that came up while I was playing around with some stuff I coded. I was wondering if there is any way to terminate a specific part of the program based on user feedback (I apologize if I am misusing terminology here) other than die(); since that ends the entire program.

here’s the code:

if ($choice eq 'y'){
print "\nHit diagnostics: \n";
{
my $hitList=@hitList;
for (my $i=0; $i<$hitList; $i++){
    print $hitList[$i]."\n";
    #segmented listout of misses with interrupt 
    if(($i%4) eq 0){
        print "CONTINUE or Q to end\n";
        my $next=<>;
        chomp($next);
        if(lc($next) eq 'q'){
            **die "Killing request...\n";**
            }
        }
    }
}

So basically I just want for the user to be able to end the modulus if loop if they decide at some point that they don’t actually want to see the entire list but still be able to continue (there is a miss prompt afterwards as well) with the program.

Is the best way to do this just to use a variable as a ‘switch’ to determine whether or not the hit list should continue? Just wondering if there is a more acceptable/elegant solution.

  • 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-08T12:12:42+00:00Added an answer on June 8, 2026 at 12:12 pm
    for my $i (0..$hitList-1) {
       ...
       if (...) {
           last;
       }
       ...
    }
    

    last

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

Sidebar

Related Questions

I have a question that doesn't need any specific answer, just a general direction
This is a general question that just popped into my head that I have
just a general design question that I'd like to hear some of your opinions
while studying some security things, there was a question that one can guess the
Just a general question here, I have an iPhone app that has 3 textfields
just a general question, do you ALWAYS have to handle error? i was just
I just have a question regarding SimpleJSON's documentation. Is it implicit understood that functions
This is a very general question that is mostly just conceptual. I was thinking
I just have a general question: has anyone successfully implemented a way to show
I just have a general question on how to create efficient programs. For example,

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.