Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: add a line based on maxline length

by Shendal (Hermit)
on Jul 31, 2002 at 19:57 UTC ( #186579=note: print w/replies, xml ) Need Help??


in reply to add a line based on maxline length

Is this what you're looking for?
use strict; my $max = 0; foreach (<DATA>) { s/(\r|\032)$//; $max = length($_) if length($_) > $max; } print " " x $max; __DATA__ This is my file it doesn't have a blank line at the end of it based on the maxline count of the file that it read.

Cheers,
Shendal

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://186579]
help
Chatterbox?
[marto]: good morning all
[Corion]: Hi marto!
[choroba]: Good morning!
[Corion]: I hope you had a good weekend!
[marto]: jetlag has really done a number on the kids, it's been a tough week
choroba played with the band on Saturday, so Sunday was very sleepy

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (10)
As of 2018-06-25 08:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?



    Results (126 votes). Check out past polls.

    Notices?