Last active
January 29, 2017 02:09
-
-
Save schwern/14a11411f08d960981c5a7dde3fa4061 to your computer and use it in GitHub Desktop.
Perl program for https://stackoverflow.com/questions/41864011/associative-arrays-python-vs-perl-vs-awk-performace/41865056#41865056
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
use v5.10; | |
for (1..400_000_000) { | |
my $key1 = int rand(2) ? "NM" : "XR"; | |
my $key2 = int rand(2) ? "NM" : "XR"; | |
my $num1 = rand(10_000_000); | |
my $num2 = rand(10_000_000); | |
my $num3 = rand(1); | |
$num3 *= -1 if int rand(2); | |
printf( | |
"%s_%9.1f,%s_%9.1f,%f\n", | |
$key1, $num1, | |
$key2, $num2, | |
$num3 | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment