in reply to Re: Number of times I've used goto in Perl
in thread Number of times I've used goto in Perl
Compare and contrast:
#!/usr/bin/env perl use strict; use warnings FATAL => 'recursion'; my $i = 0; one(); sub one { print "$i\n" unless ++$i % 10; push @_, 'foo'; &one; }
#!/usr/bin/env perl use strict; use warnings FATAL => 'recursion'; my $i = 0; one(); sub one { print "$i\n" unless ++$i % 10; push @_, 'foo'; goto &one; }
Like much in the way of the Swiss Army Chainsaw you need to know precisely what you're doing if you run it with the guards off. Limbs can be easily lost.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Number of times I've used goto in Perl
by LanX (Saint) on Sep 26, 2018 at 14:19 UTC | |
by Eily (Monsignor) on Sep 26, 2018 at 15:04 UTC |