Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
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 ( [id://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 (Bishop) 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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11105968]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2024-04-19 03:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found