boxprint("
My program v. 1.0
Parameters:
FASTA-filename Coverage ReadLength");
sub boxprint {
$max = 0;
# Receive input: its a multiline string
$string = $_[0];
# Split on newline: now I have an array
# with all the lines
@lines = split (/\n/, $string);
# I perform a first cycle to detect the longest
# line
foreach $l (@lines) {
$max = length($l) if ($max<length($l));
}
# Prepare a separator $max character long
$sep = '-' x $max;
# Print first line
print '+-'.$sep."-+\n";
# Second cycle to surround each line with vertical
# bars (|)
foreach $l (@lines) {
$cur = length($l);
$space=' ' x ($max-$cur);
$l = '| '.$l.$space.' |';
print "$l\n";
}
# Final separator
print '+-'.$sep."-+\n";
}