Jakob Kofoed wrote:
>
> Hi All,
Hello,
> I have a file looking like (where \n is new line):
>
> blabla\n
> blablablablablabla\n
> blablablablablablablablablabla\n
> blabla\n
>
> but I need every line to have 80 characters - in this case filled with white
> space.
>
> I can figure out how to do it when I have the same character number in every
> line - but when the lines changes in length - I'm lost!!
>
> The output should look like:
>
> blabla
> \n
> blablablablablabla
> \n
> blablablablablablablablablabla
> \n
> blabla
> \n
>
> I would appreciate any suggestions or hints.
You can use the pack function for this:
while ( <FILE> ) {
chomp;
print pack( 'A80', $_ ), "\n";
}
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>