Last active
December 27, 2017 03:49
-
-
Save jessebutryn/a3f5801532d887532eb431d55209b40d to your computer and use it in GitHub Desktop.
Perl Tree
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
#! /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