in reply to 1 != split /a/, '' ?

If I understand you correctly, the only problematic case for the split with -1 is the empty one. You can solve it by
push @keys, [ split /\./, $key_string, -1 ]; $keys[-1] = [ q() ] unless @{ $keys[-1] };

I'm not sure it's more elegant than yours (elegance is in the eye of the beholder). In your solution, you can use just '.', the A is not needed.

Note that I used a different names for the array and scalar.

I don't understand the preamble. Do you need Data::Diver?

لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^2: 1 != split /a/, '' ?
by ikegami (Patriarch) on Nov 03, 2015 at 13:27 UTC
    [ length($key_string) ? split(/\./, $key_string, -1) : '' ]
      what is the -1 in split meaning?

        If LIMIT is negative, it is treated as if it were instead arbitrarily large; as many fields as possible are produced.

        Cheers, Sören

        Créateur des bugs mobiles - let loose once, run everywhere.
        (hooked on the Perl Programming language)