# at the top use Readonly; Readonly my $PATIENT_ID => 0; Readonly my $DOB => 1; # and in the main code ... my %data; my $linetype = determine_type( $line ); if ( $linetype == $PATIENT_ID ) { process_patient( $line, \%data ); elsif ( $linetype == $DOB ) { process_dob( $line, \%data ); elsif ...