Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# Mapping Excel Column Name ("A", ..., "Z") to Perl Arrayindex
sub EC {
my $name = shift;
if ($name !~ /^[A-Z]+$/i) {
die "ungültiger Spaltenname $name\n";
}
# mehrstellige Spaltennamen rekursiv lösen
if ($name =~ /^([A-Z])([A-Z]+)$/i) {
return 26**length($2) * (EC($1)+1) + EC($2);
}
return ord(uc $name) - 64 - 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment