update I misunderstood the question. I thought you wanted at most 6 characters, but it seems you want always exactly 6 characters. In that case use:
sprintf("%6.6s", $line)
In reply to Re: Alternative to substr on unknown length of scalar
by thospel
in thread Alternative to substr on unknown length of scalar
by PerlingTheUK
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |