in reply to Finding names in files

narrowly re case insensitivity: regexen make it easy.
Instead of your
foreach($_){$count++;}; 033: if (($_ ne "Dave") && ($count <= 20)) 034: {
a small change such as (untested):
foreach($_){$count++;}; 033: if (( $_ !~ /dave/i ) && ($count <= 20)) 034: {
where the "!~" and the ".../i" make the regex fail if any variant of DAVE, dave, Dave, etc is present...

However, my quick read and slow mind make me wonder if my logic (which follows yours) is correct -- ie, whether you really want a negative there... Resolution left as an exercise for the student...

Replies are listed 'Best First'.
Re^2: Finding names in files
by gzayzay (Sexton) on Mar 29, 2006 at 17:32 UTC
    Hey WW;

    I was following your entire comments until the last two lines. Are you a philosopher...LOL. Anyway, Thanks for the help.