Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Golf: Length of longest line in a file

by toolic (Bishop)
on Jul 02, 2010 at 16:01 UTC ( #847747=perlmeditation: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use warnings;
    use strict;
    ...
        $max = $len if $len > $max;
    }
    print "$max\n";
    
  2. or download this
    a
    abc
    abcdef
    abcd
    abcde
    
  3. or download this
                  1         2         3        
         12345678901234567890123456789012345678
    
  4. or download this
    perl -nE'$l=y///c;$m=$l if$l>$m;END{say$m}' file.txt
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://847747]
Front-paged by Arunbear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (9)
As of 2015-07-02 06:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (30 votes), past polls