Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^7: Simplify code in Perl with "unless" conditionnal

by haukex (Archbishop)
on May 30, 2016 at 17:12 UTC ( [id://1164521]=note: print w/replies, xml ) Need Help??


in reply to Re^6: Simplify code in Perl with "unless" conditionnal
in thread Simplify code in Perl with "unless" condition

Hi Chaoui05,

Well, to randomize it, you can shuffle both the list of browsers and the list of combinations, that'll ensure that you always have all comparisons but in a random order:

use List::Util 'shuffle'; use Algorithm::Combinatorics 'combinations'; my @browsers = shuffle('firefox', 'chrome', 'internet explorer'); for my $c (shuffle combinations(\@browsers,2)) { print "Compare $$c[0] with $$c[1]\n"; } __END__ Compare internet explorer with firefox Compare firefox with chrome Compare internet explorer with chrome

Hope this helps,
-- Hauke D

Replies are listed 'Best First'.
Re^8: Simplify code in Perl with "unless" conditionnal
by Chaoui05 (Scribe) on May 31, 2016 at 07:24 UTC
    Thanks , it seems even more better
    *****Lost in translation****TIMTOWTOI****

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1164521]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (1)
As of 2024-04-25 04:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found