in reply to Google has failed me! Using pack and substr for fixed width file output
Hello spudulike, and welcome to the Monastery!
Your first line, $line = pack ("A1170") ;, fills $line with a string of 1170 spaces. The next line, substr ($line, 0, 135) = " " ;, replaces the first 135 characters of $line with a single space, thereby shortening the string by 134 characters. Similarly, the next-to-last line shortens the string by a further 506 characters! What are those two lines intended to do?
I think you need to study the documentation for the substr function. :-)
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Google has failed me! Using pack and substr for fixed width file output
by spudulike (Novice) on Apr 08, 2014 at 12:52 UTC |