Skip to content

Instantly share code, notes, and snippets.

@throughnothing
Created April 30, 2012 03:50
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • 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