> Hi, I'm trying to find out how many newline characters are in 
> a string.  I thought there would be a simple function for 
> this, but I can't find it; Do I need to step through the 
> string a character at a time to check this?

I have used this:

#!/usr/bin/perl
use warnings;
use strict;

my $string = "newline\nstring\nhere\n";

print (my $count = $string =~ s/\n/\n/g);

But I've always thought there must be a more straightforward way.. This
definitely seems a little clunky. Anybody else have something for this?

Thanks
Matt

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to