Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Golf: Length of longest line in a file

by toolic (Chancellor)
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 drinking their drinks and smoking their pipes about the Monastery: (9)
As of 2014-12-26 13:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (171 votes), past polls