in reply to get_xf_index error

Guessing from the error message, because of the closure

my $worksheet ... sub colcmp { ... $worksheet

Usually the remedy is to write your functions like

colcmp( $worksheet, ... ); sub colcmp { my( $worksheet, ... }