in reply to Don't get the output as expect.

G'day mandalmanas5519,

You've got your logic fairly messed up there with the same condition controlling both the if and the elsif.

Perhaps drawing yourself a flow chart or writing some pseudocode might help. From your description, I think you want:

Want SAB? If 'y' Get SAB Want Date? If 'y' Get Date else Exit

Once you've got the logic sorted out, there's a few other issues you'll need to address. For instance, use strict; will probably tell you about most of them (see strict) and you may want to chomp $date.

-- Ken