use strict; sub emphasize() { # Takes a string and prints it to screen surrounded by astericks f +or emphasis my $screen_width = 80; my $printable_space = ($screen_width - 2); my $string = shift; my $string_length = length($string); if ( ($string_length % 2) != 0 ) { $string .= " "; } print "*" x $screen_width; print "*"; print " " x $printable_space; print "*"; print "*"; print " " x (($printable_space - $string_length) / 2); print "$string"; print " " x (($printable_space - $string_length) / 2); print "*"; print "*"; print " " x $printable_space; print "*"; print "*" x $screen_width; }
In reply to Emphasize a string by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |