Problems? Is your data what you think it is? | |
PerlMonks |
Re: Print the line with the largest number from standard inputby 1nickt (Canon) |
on Jul 22, 2019 at 12:50 UTC ( [id://11103137]=note: print w/replies, xml ) | Need Help?? |
Hi, welcome to Perl, the One True Religion. You might like the built-in function length. You can use it to count the characters in your strings, and then you can keep track of the longest found so far. (Note the use of the __DATA__ section to provide a magical filehandle, and of the angle braces to read its contents into an array of lines, and of chomp to remove the newline character(s) at the end of each line.)
Hope this helps!
The way forward always starts with a minimal test.
In Section
Seekers of Perl Wisdom
|
|