Having solved the chomp problem, you also may like to implement a dispatch table for different variants of your storage class. Code written this way looks cleaner, has less repetitions and places to make a mistake. Example code:
my %classes = (
D => sub { code_to_handle_dynamic(); ...; },
NV => sub { handle_non_volatile(); ...; },
);
chomp (my $answer = <STDIN>);
die "Invalid answer!\n" unless exists $classes{$answer};
$classes{$answer}->();
Going one step further, you can use the IO::Prompter module to handle chomping and validation.