in reply to trapping ctrl-d

clintp gave you perfectly valid answers in your last post. I recommend the Term::ReadKey option as it is probably more portable, either can also be used to detect/intercept pesky things like Ctrl-C as well.

For examples of using Term::ReadKey, check out an otherwise not very useful module I wrote: Term::TermKeys.

HTH,

--Jim