Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Golf: Length of longest line in a file

by toolic (Bishop)
on Jul 02, 2010 at 16:01 UTC ( [id://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
Domain Nodelet?
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?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (4)
As of 2024-04-24 19:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found