[plug] Perl query: Counting letters in a string.

David Buddrige buddrige at wasp.net.au
Thu Feb 20 16:41:10 WST 2003


Hi all, 

I need to write a perl program that will identify any lines in a C++ source 
file that are > 80 characters long, and chop them into 2 lines at an 
appropriate point in the string.  However, in order to do this, I need to 
determine how long the string is. 

The script consists of the following loop: 

while(<>)
{
 $line_of_code = $_;
 # Now count the characters in $line_of_code and process if > 80.
} 

Can someone let me know how to determine how many characters are in 
$line_of_code? 

thanks heaps 

David.



More information about the plug mailing list