the man page says that \"The exec() family of functions replaces the current process image with a new process image.\" but I am not quite understand the meaning of \"replace
You are correct. perror will not be called unless the execl fails. The exec
functions are the means for starting new processes in a POSIX compliant OS (typically combined with a fork
call). Maybe an example will help. Suppose your program, call it programX, is running. It then calls one of the exec functions like the one you have above. programX will no longer exist as a running process. Instead, ls will be running. It will have the same exact PID as programX, but pretty much be a whole new process otherwise.