Using
goto is generally considered to be bad style as it can make your code hard to follow. Consider re-coding the above snippet without using a
goto, eg:
#! /usr/bin/perl
use strict;
use warnings;
sub get_input {
print "Type R to re-enter the values or Type E to exit:\n";
chomp (my $value = <STDIN>);
$value;
}
my $value = get_input();
while ($value ne 'E') {
if ($value eq 'R') {
$value = get_input;
} else {
print 'Invalid entry, please try again\n';
get_input;
}
}
exit();
----------
My cow-orkers were talking in punctuation the other day. What disturbed me most was that I understood it.