Skip to content

Instantly share code, notes, and snippets.

@throughnothing
Created April 30, 2012 03:50
Show Gist options
  • Save throughnothing/2555345 to your computer and use it in GitHub Desktop.
Save throughnothing/2555345 to your computer and use it in GitHub Desktop.
spark clone in perl
#!/usr/bin/env perl
# parks - spark clone in perl (https://github.com/holman/spark)
# Alternatives: https://github.com/holman/spark/wiki/Alternative-Implementations
# Wicked Cool Examples: https://github.com/holman/spark/wiki/Wicked-Cool-Usage
use List::Util qw( min max ); local $/;
my ($t, @n) = ( [qw(▁ ▂ ▃ ▄ ▅ ▆ ▇ █)], -t STDIN ? @ARGV : split ' ', <STDIN> );
print map($t->[ int( ( $_ - min(@n) ) / max(@n) * $#$t ) ], @n), "\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment