in reply to Creating trailer on packets

A couple of routines from my utils.pm

sub padr{ substr $_[ 0 ] . $_[ 1 ] x $_[ 2 ], 0, $_[ 2 ]} sub padl{ substr $_[ 1 ] x $_[ 2 ] . $_[ 0 ], -$_[ 2 ] } print padl 'fred', '.', 20; ................fred print padr 'fred', '.', 20; fred................

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.

Replies are listed 'Best First'.
Re^2: Creating trailer on packets
by tlm (Prior) on May 16, 2005 at 10:23 UTC

    These are rather procrustean: they pad the short strings, but also truncate the long ones.

    the lowliest monk

      These are rather procrustean:

      Having looked that up. Agreed!

      Another way of looking at that is WAD--working as designed for the purpose I had for them.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
      "Science is about questioning the status quo. Questioning authority".
      The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.