# -------------------------------------------------------------------- +----- # read array from file sub read_file { my ( $line ); if ( not open(FILE, $file_path) ) { &logging( "Can't open database file." ); die; } if ( $file_lock ) { flock(FILE, 1); } @file = (); while ( $line = ) { chomp($line); push(@file, $line); } }

#### # -------------------------------------------------------------------- +----- # write array back to file sub write_file { my ( $line ); if ( not open(FILE, ">".$file_path) ) { &logging( "Can't open database file." ); die; } if ( $file_lock ) { flock(FILE, 2); } foreach $line ( @file ) { print FILE "$line\n"; } close(FILE); }