Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: How to build a better mousetrap (or a variable to hold a column-measuring scale)

by shmem (Chancellor)
on Sep 10, 2019 at 14:19 UTC ( #11105968=note: print w/replies, xml ) Need Help??


in reply to How to build a better mousetrap (or a variable to hold a column-measuring scale)

join map sprintf:

use 5.10.0; $_=join"+",map{$n=$_*10;sprintf" %-5s",$n%100||$n}1..22; s/ /-/g; # replace blanks with dashes s/-/|/; # make first dash into a pipe sign $_.='|'; # add pipe sign to the end say; __END__ |---10---+----20---+----30---+----40---+----50---+----60---+----70---+ +----80---+----90---+----100--+----10---+----20---+----30---+----40--- ++----50---+----60---+----70---+----80---+----90---+----200--+----10-- +-+----20---|
perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'
  • Comment on Re: How to build a better mousetrap (or a variable to hold a column-measuring scale)
  • Download Code

Replies are listed 'Best First'.
Re^2: How to build a better mousetrap (or a variable to hold a column-measuring scale)
by roho (Chancellor) on Sep 13, 2019 at 12:52 UTC
    Thank you shmem. I think this is the one I will go with. I tweaked your entry a little to get the first 5 characters right.
    use 5.10.0; $_=join"+",map{my $n=$_*10;sprintf" %-5s",$n%100||$n}1..22; s/ /| + /; # make first blank a pipe sign s/ /-/g; # replace blanks with dashes $_.='|'; # add pipe sign to the end say; __END__

    "It's not how hard you work, it's how much you get done."

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11105968]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2020-06-07 10:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you really want to know if there is extraterrestrial life?



    Results (42 votes). Check out past polls.

    Notices?