in reply to Simplify code in Perl with "unless" condition
There's a lot of repitition there as you can doubtless see. This suggests a loop. Here's an outline:
#!/usr/bin/env perl use strict; use warnings; my @things = qw/firefox chrome exploder/; while (my $this = shift @things) { for my $that (@things) { print "Now compare $this with $that\n"; } last if $#things < 1; }
You can obviously replace the print statement with whatever block you require for each permutation of entries in @things. HTH.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Simplify code in Perl with "unless" loop
by Chaoui05 (Scribe) on May 27, 2016 at 15:47 UTC | |
by AnomalousMonk (Archbishop) on May 27, 2016 at 16:23 UTC | |
by Chaoui05 (Scribe) on May 27, 2016 at 16:29 UTC |