in reply to nested if statement wont work

Put a use strict in your code, fix the errors and then you will see:

Bareword "IN" not allowed while "strict subs" in use at - line 16.

This is my quick version. Note the differences:

my $ffdb = "ffdb.dat"; open my $fd, '<', $ffdb or die "open: $!"; chomp (my @ffdbdata = <$fd>); close $fd; print "Enter ID \n"; chomp (my $ID = <STDIN>); print "Cant be empty!\n" unless length $ID; open $fd, '>', $ffdb or die "open: $!"; foreach my $line (@ffdbdata) { my @column=split /\|/, $line; if ($column[0] eq $ID) { print $fd "$column[0]|", $column[1] eq 'IN' ? "OUT\n" : "IN\n"; } else { print $fd "$line\n"; } } close $fd;

--
David Serrano