Skip to content

Instantly share code, notes, and snippets.

@jessebutryn
Last active December 27, 2017 03:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jessebutryn/a3f5801532d887532eb431d55209b40d to your computer and use it in GitHub Desktop.
Save jessebutryn/a3f5801532d887532eb431d55209b40d to your computer and use it in GitHub Desktop.
Perl Tree
#! /usr/bin/env perl
$my_tree = '#';
$max_length = 70;
for ($i=0; $i <= 20; ++$i) {
printf "%s%-${max_length}s\n", ' ' x int(($max_length - length $my_tree)/2), $my_tree;
$my_tree = $my_tree . '##';
}
$my_trunk = substr( $my_tree, 0, 6 );
for ($i=0; $i <= 4; ++$i) {
printf "%s%-${max_length}s\n", ' ' x int(($max_length - length $my_trunk)/2), $my_trunk;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment