data ---- one two three three one two one one three my %currentData; open (DATA, "data") or die ""; my $line; while ($line = ) { chomp $line; $currentData{$line}++; } close DATA; # Now after reading the user inputs for updating the file as follow my @updateInfo; my @updateInfo = "$inputONE\t$inputTwo\t$inputThree"; if ( $currentData{$line} ) { print "the info exists already\n"; exit; } else { print " your info is being saved and the file is updated\n"; exit; }