Hi guys,

The following script works as I want except for one thing; if I call the
script with no arguments I want it to list the whole phone book, which it
does, but it also gives me two of the "Use of
uninitialized value" warnings at the end. What would be a good way to stop
this?

Thanks.

#!/usr/bin/perl -wT
use strict;
my($nameIn) = $ARGV[0];
open(IN, "$ENV{HOME}/.phonebook") || die "Can't open Phone Book: $!\n";
while(<IN>) {
    chomp;
    my($fileName, $phoneNum) = split(/,/, $_);
    my($foundIt) = index(lc($fileName), lc($nameIn));
        if($foundIt >= 0) {
            print "\t\t\t$fileName - $phoneNum\n";
        }
}

-- 
Rob

Good judgement comes from experience, and experience -
well, that comes from poor judgement.



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

Reply via email to