Define "empty string". Consider:
use strict;
use warnings;
for my $str ('', ' ', '\0', "\n", undef) {
print "matched '$str'\n" if $str =~ /\A\z/;
}
Prints:
matched ''
Use of uninitialized value $str in pattern match (m//) at C:\Users\Pet
+er\Delme~~\PerlScratch\noname.pl line 8.
matched ''
Use of uninitialized value $str in concatenation (.) or string at C:\U
+sers\Peter\Delme~~\PerlScratch\noname.pl line 8.
length may be a better test than using a regex, and clearer to the maintenance programmer.
True laziness is hard work