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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:50:11+00:00 2026-06-18T12:50:11+00:00

Found this inside a loop. I’ve read up about splice but it just confused

  • 0

Found this inside a loop. I’ve read up about splice but it just confused me more.
I’m not familiar with Perl, but am trying to translate an algorithm to another language.

my $sill = splice(@list,int(rand(@list)),1);
       last unless ($sill);

To be more specific: What will be inside $sill if it doesn’t exit the loop from the last?

Thanks for any help!

  • 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-18T12:50:12+00:00Added an answer on June 18, 2026 at 12:50 pm

    This randomly removes one element from the array @list. That value is assigned to $sill. If that was a false value, the enclosing loop (not shown) is broken out of.

    splice takes an array, an offset, and a length, plus a replacement list. If the replacement is omitted, the elements are deleted.

    The length is constant (1 element), but the offset is calculated as a random integer smaller between 0 and the length of @list.

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

Sidebar

Related Questions

Found this Multimap containing pairs? , but it is not much help How would
inside of my Zend_Db_Table_Rowset Object i found this: [_primary:protected] ... does anybody if theres
Below is some html I found in this jquery tooltip tutorial, the contents inside
Found This: tyty stack, Social Icons not working with Infinite Scrolling on Wordpress I'm
found this little code snippet that seems to do what i want, but im
Found this: Sub SurroundWithAppendTag() DTE.ActiveDocument.Selection.Text = .Append( + DTE.ActiveDocument.Selection.Text + ) End Sub But
This may be a little subjective, but I have often found that it can
I inherited a buggy PHP page. I'm not an expert of this language but
I found this piece of code inside System.Web.ISAPIRuntime using Reflector public void DoGCCollect() {
Found this while reading the Neo4j manual, specifically here , I found the sentence:

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.