Oh in this case I'd use the same "match-and-printf" construct, it's extremely flexible.
D:\tmp>perl -E"say '.' x rand(70) . '# test comment' for 1..3" ....................# test comment ...................................# test comment .......................# test comment D:\tmp>perl -E"say '.' x rand(70) . '# test comment' for 1..20" |perl +-lpe " /(.*?)(#.*)/ and $_ = sprintf qq{%-68s %s},$1,$2" ..................... +# test comment .............................................................. +# test comment ..................................................................... + # test comment .................................... +# test comment .......................................................... +# test comment ............................................... +# test comment ............................................................ +# test comment ............. +# test comment ........................... +# test comment ............... +# test comment .............................. +# test comment .................................... +# test comment ................................................... +# test comment ................................. +# test comment ........................................................... +# test comment .......... +# test comment ....................................................... +# test comment ................................................................. +# test comment .......................................... +# test comment ................................................................ +# test comment
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
FootballPerl is like chess, only without the dice
In reply to Re^4: One-liner to append text at fixed column
by LanX
in thread One-liner to append text at fixed column
by LanX
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |