DB<111> $p = '|----+----' DB<112> p map { $a=$p; substr $a,0,length($_),$_ ;$a} "", map {$b=$_ +%10; $b ? $b*10 :$_*10 } 1..22 |----+----10---+----20---+----30---+----40---+----50---+----60---+---- +70---+----80---+----90---+----100--+----10---+----20---+----30---+--- +-40---+----50---+----60---+----70---+----80---+----90---+----200--+-- +--10---+----20---+---- DB<113> p map { $a=$p; substr $a,0,length($_),$_ ;$a} "",map $_*10, +map {1..9, $_*10} 1..2 |----+----10---+----20---+----30---+----40---+----50---+----60---+---- +70---+----80---+----90---+----100--+----10---+----20---+----30---+--- +-40---+----50---+----60---+----70---+----80---+----90---+----200--+-- +-- DB<121> p map { $a=length; $p =~ s/.{$a}/$_/r} "", map {$b=$_%10; $b + ? $b*10 :$_*10 } 1..22 |----+----10---+----20---+----30---+----40---+----50---+----60---+---- +70---+----80---+----90---+----100--+----10---+----20---+----30---+--- +-40---+----50---+----60---+----70---+----80---+----90---+----200--+-- +--10---+----20---+----
the initial pattern is buggy, replacing $p = '|---+----' would fix it.
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
FootballPerl is like chess, only without the dice
In reply to Re: How to build a better mousetrap (or a variable to hold a column-measuring scale)
by LanX
in thread How to build a better mousetrap (or a variable to hold a column-measuring scale)
by roho
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |