roho has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use strict; use warnings; my $old = '|---+----10---+----20---+----30---+----40---+----50---+---- +60---+----70---+----80---+----90---+----100--+----10---+----20---+--- +-30---+----40---+----50---+----60---+----70---+----80---+----90---+-- +--200--+----10---+----20---+----'; my $new = '|---+----'; # Set base value starting with vertical bar. for (my $i = 10; $i <= 220; $i+=10) { my $j = $i; $j = $i-200 if $i > 200 && $i < 300; # Change '210' to '10', '220 +' to '20', etc. $j = $i-100 if $i > 100 && $i < 200; # Change '110' to '10', '120 +' to '20', etc. my $filler = $i == 100 || $i == 200 ? '--+----' : '---+----'; # A +djust filler for 3-digit number. $new .= $j . $filler; } print "\nold=$old\n\nnew=$new\n";
"It's not how hard you work, it's how much you get done."
|
|---|