#!/usr/bin/env perl use strict; use warnings; use List::Util qw{min max}; # Built-in functions my @values = (7,9,2,0,1,2,4,3,9); print 'Min: ', min(@values), "\n"; print 'Max: ', max(@values), "\n"; print 'Count: ', 0+@values, "\n"; # How to get from (0,0) at top left to bottom left my @matrix = ( [' ' x 2, '*', ' ' x 2], [' ', '*', ' ', '*', ' '], ['*', ' ' x 3, '*'], ); print "\nOriginal:\n"; for (0 .. $#matrix) { print @{$matrix[$_]}, "\n"; } print "\nInverted:\n"; for (reverse 0 .. $#matrix) { print @{$matrix[$_]}, "\n"; } # A complete guess about your graph my @graph; for (0 .. max(@values)) { $graph[$_] = [(' ') x @values]; } for my $i (0 .. $#values) { $graph[$values[$i]][$i] = '*'; } print "\nGraph:\n"; for (reverse 0 .. $#graph) { print @{$graph[$_]}, "\n"; }