Perl: how to break out of a nested loop? I've got an issue with an exercise in Perl. I would like to scan huge textfiles with Regex. Everything works just fine, but when i've found the Stop Codon at the nested while loop, the first while loop takes over, but it should continue from the last position of the found stop codon. Could someone give me a hint where to look?  I've tried the last statement, but that doesn't work.  use strict; use warnings; $|=1;  sub read_Fasta {     my ($filename) = @_;   open (FIN, "&lt;$filename") or die "Bestand $filename niet te openen\n";   my $sequence = "";   while (my $line = &lt;FIN&gt;) {       if ($line =~ /^\s*$/) {       next;     } elsif ($line =~ /^\s*#/) {       next;     } elsif ($line =~ /^&gt;/) {       next;     } else {       $sequence .= $line;     }   }   close (FIN);   $sequence =~ s/\s//g;   return ($sequence); }  print "Het vinden van ORF's in een organisme.\n\n"; print "Bestanden worden geladen vanuit de locatie C:\\ \n"; print "Voer bestandsnaam (inclusief extensie) in:\n"; my $path = &lt;STDIN&gt;; chomp ($path); $path = "C:\\$path";   my $DNA_seq = &amp;read_Fasta($path); chomp ($DNA_seq); print "De DNA sequentie is gevonden\n";  print "voer de minimale lengte van de ORF in: \n";  my $minlengte_ORF = &lt;STDIN&gt;; chomp ($minlengte_ORF);  if ($minlengte_ORF =~ /^[0-9]+$/ &amp;&amp; $minlengte_ORF &gt;= 1) { print "De gevonden ORF's zijn:\n";  while(($DNA_seq =~ (/[ATG]TG/ig))) {     my $startcodon = $&amp;;     my $pos_startcodon = pos($DNA_seq);     $pos_startcodon -= 2;     my $stringvanafstart = $';     while($stringvanafstart =~ (/(TAA)|(TAG)|(TGA)/ig)){         my $stopcodon = $&amp;;         my $lengte_ORF = length ($`);         $lengte_ORF += 3; #vanwege meetellen startcodon.         my $pos_stopcodon = pos ($stringvanafstart);         $pos_stopcodon -= 2;         if($lengte_ORF % 3 == 0){             if($lengte_ORF &gt;= $minlengte_ORF)   {             print "de positie van het startcodon $startcodon is $pos_startcodon \n";             print "de positie (vanaf het startcodon) van het stopcodon $stopcodon is $pos_stopcodon \n";             print "de totale lengte van de ORF bedraagt $lengte_ORF basen\n";             #Go back to first while loop, exclude everything till endposition.  } else{     next; } } else{     next; } } } } else{     print "Invoer is onjuist, minimale lengte mag alleen getallen bevatten en/of moet groter zijn dan 0! \n"; }
How do I break out of a loop in Perl? I'm trying to use a break statement in a for loop, but since I'm also using strict subs in my Perl code, I'm getting an error saying:     Bareword "break" not allowed while   "strict subs" in use at ./final.pl   line 154.   Is there a workaround for this (besides disabling strict subs)?  My code is formatted as follows:  for my $entry (@array){     if ($string eq "text"){          break;     } }
Continued fraction of $e^{-2\pi n}$ I found this problem on a well-known problem solving website. It is apparently from Ramanujan.     With   $$\LARGE{a = \frac{1}{1 + \frac{e^{-2\pi}}{1 + \frac{e^{-4\pi}}{1 + \ddots}}}},$$   what is $a$?   The basic methods I know for questions of this type were not helpful to me.  I do not require a full solution, but feel free to post one if you would like. Hints or lecture notes on how to solve problems of this nature would be appreciated.   Keep in mind that I am at an undergraduate level in mathematics. Suppose $f$ is a differentiable function over $\mathbb{R}$ satisfying $f(0) = 0$. Show that if $f'$ is strictly increasing, then $\frac{f(x)}{x}$ is increasing over $(0,\infty)$.   Attempt:  Since $f'$ is increasing we know that $f'' &gt; 0$ for all $x$. Now let $g(x) = \frac{f(x)}{x}$ and thus $f(x) = xg(x)$. Then we wish to show that $g'(x) &gt; 0$ on $(0,\infty)$ and so since $f'(x) = xg'(x)+g(x)$ and $f''(x) = xg''(x)+2g'(x) &gt; 0$, we have $g''(x) &gt; \frac{-2g'(x)}{x}$. I am not sure how to use this though to prove the statement. Should I say "She is in the park" or "She is at the park"? Why is it better to use "#!/usr/bin/env NAME" instead of "#!/path/to/NAME" as my shebang? Why must fermions be antisymmetric? I have read that fermions cannot exist in the same state simultaneously. I understand why indistinguishable particles with an antisymmetric superposition of states can't exist in the same state simultaneously, but why must fermions have an antisymmetric superposition of states?  The only characterising property I know of fermions having besides antisymmetry is spin, for which they have half-integer. I understand that this is the case simply because particles with half-integer spin and particles with zero or integer spin were defined as fermions and bosons respectively.  My perusal of the Wikipedia page on the  leaves me under the impression that spin has nothing to do with the wavefunction's symmetry properties:     Naively, neither has anything to do with the spin, which determines the rotation properties of the particles, not the exchange properties.   Are antisymmetric wavefunctions simply classified as fermions, in the way half-integer spin particles were? I don't see how this could be the case, as, if spin and symmetry were independent, half-integer spin particles with symmetric wavefunctions (and antisymmetric integer spin particles) would be possible. How to take the gradient of the quadratic form? Is this a capacitor start motor and can I start it with a microwave capacitor I salvaged an old motor out of a air conditioner and I want to know if it's a capacitor start motor if I can start it with the capacitor I have and how to start it.  I included pictures of the motor and capacitor btw i have never worked with capacitive start motors so i need details on exactly how to wire it up with out ruining it How do I mirror the faces of a cube (edit all of them when I edit one)? Suppose that $f:[0,\infty)\rightarrow\mathbb{R}$ is continuous. Is it true that   $$\int_{0}^\infty|f(t)|dt&lt;\infty\Rightarrow \lim_{t\rightarrow\infty}f(t)=0?$$  If so can you provide a proof, otherwise a counter example. Thank you. For whatever reason, we do no longer need to be root (or using sudo) to run /sbin/shutdown, /sbin/reboot etc.  This seems to be because those executables are now symlinks to /bin/systemctl which handles everything as normal user.  However, what if I want shutdown and reboot to require root authentication again? How can I achieve this? Should I use #define, enum or const? What is a StackOverflowError, what causes it, and how should I deal with them? Can you make an opportunity attack against a moving object? Can hard drives fully utilize SATA III? My motherboard currently supports both SATA II and III (3 Gb/s and 6Gb/s respectively), but after reading some online, it seems as though connecting a HDD to the 6 Gb/s is pretty much pointless. If this is the case I'm going to leave my two SATA III ports open for something that can actually use it (which at this point I'm not really sure what can).  This is part of an article I read:     In terms of everything else, we saw basically no difference from the same single drive being plugged into a SATA 6Gb/s or SATA 3Gb/s port. All of this is obviously due to the hard drive not being able to actually take advantage of the 6Gb/s bus.   from . The only things I've found so far are a cart method (which ceased working in 1.6), a dispenser method (utilizing the decay on dropped items, but this requires occasional feeding), and a binary counter (which won't work for a single input but rather a fluctuating one).  I want to have a circuit that when I apply an input signal, the output signal doesn't change for 2 to 5 minutes.  When the input turns off, I again want a 2 to 5 minute delay.  I could accomplish this with (roughly) 240 to 600 redstone repeaters, but this is far in excess of being useful.  The only method I can think of, but would require a XOR gate (on the button-input and final output) to start and stop a clock attached to a binary counter.  While I can make room for a device of this size, I was hoping for something simpler. Can "it" be used with plural subject? Several years ago I heard of something called dummy subjects in high school. It was then stated that, for example, it is a dummy subject when it starts many instances of sentences, e.g.        It is rainy today.   It is hard to imagine how hard is to live alone.   It is not my university degree that matters here.     My question is if we can use it with plural subjects? For example in       If some think that in Mahmoud Dowlatabadi’s works it is only social themes that matter and the writer is ignoring fictional arrays and artistic techniques, at least, endings of his stories show wrongness of this idea.     My question deals with the italicized part. If this usage is OK, can we also write they are social themes that matter? I mean can they also play the role of a dummy subject? A fellow player is uncooperative with the group and gets GM favoritism. How do I handle this? I actually have two situations but they are interconnected. Our group is currently playing a Dresden game. The GM and one of the players are married. Along with that, he is a new member to the group. I can understand her (the GM) wanting to make him feel welcome but it has gone into the the realm of blatant favoritism. A few examples:   Every idea he has is deemed fantastic, wonderful, awesome and is always successful. Most of the time he doesn't have to roll to see if he succeeds; he just does. After a series of major setbacks to the other player's characters, I joked that her husband was the only one left to mess with. Her answer to that was that she would absolutely not be messing with him in the game. He and his character were safe from that. In the last session, he and another player had to make the same roll using the same skill for the same information. He needed a fair to succeed. The other player needed a great. Not the first time that has happened.    The second part of this has to do with him as well. As I said, he is new to the group. When we were discussing a game to play, it was made clear that it would be cooperative. We would all be working together to a common end. However, he will not- I mean ever- share any information with the rest of the group. No matter how vital or needed that information is to advance the story, he just smiles and says he's got nothing. To try and get around this problem, a group aspect was created. That way if a situation or information that everybody needed to know came up, a fate chip could be played and anyone who wanted to be a part of it could be present. He is totally abusing it. Now, instead of just not telling us anything, he adds give me a fate chip and maybe I'll tell you something. It's like he is trying to beat us at the game and that is not the way it was set up.    So, the question to these two situations is what do I do? How do I handle this in a rational and sensitive way? To complicate things further, the GM is my best friend. He is her husband. I don't want to put her in the middle but I am about ready to quit the game. I am tired of it being his game and everyone else being bit players. Should I talk to her or should I talk to him? If anyone has had experience with this, any advice would be appreciated. Routing Applications sound to different sound device? (Windows) I want to cd into /var/named but it gives me a permission denied error, and when I want to use sudo to do this I am not permitted. What is the technical reason for this, and is it possible to do this some other way? I was wondering if there are functions for which $$f'(x) &gt; f(x)$$ for all $x$. Only examples I could think of were $e^x - c$ and simply $- c$ in which $c &gt; 0$. Also, is there any significance in a function that is always less than its derivative?    Edit: Thank you very much for all the replies. It seems almost all functions that apply are exponential by nature...  Are there more examples like - 1/x?  Again are there any applications/physical manifestations of these functions? [for example an object with a velocity that is always greater than its position/acceleration  is always greater than its velocity]