On Fri, Nov 16, 2007 at 09:44:51AM -0800, lerameur wrote: > hello, I have a small function using lenght, I am getting the > following error: > Use of uninitialized value in length at ./count2.pl line 95, < > $wordlisting1> line 1. > > while (my $line = <$wordlisting1> ) { > if ($line =~ m/backlog/ ) { > my @items = (split(/,/,$line))[0..88]; > if (length($items[86]) == 0){ > $counter++; > } > } > } > > anybody know why ?
I presume it is because there are fewer than 86 commas on the first line of that particular file. You might not care about that, and so you could check for definedness before checking the length, or you might want to turn off that warning for a little while. Or it might be showing a real problem in your code or your data. You might also be interested in looking into using a third argument for split(). -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/