- foreach my $idx (1..$num_args) {
- # Force flattening from SL::Presenter::EscapedText: "" . $...
- $args[$idx - 1] = "" . $args[$idx - 1];
- $args[$idx - 1] =~ s/^\s+//;
+ foreach my $idx (0..$num_args - 1) {
+ # Force flattening from SL::Presenter::EscapedText and trim leading whitespace for scalars
+ $args[$idx] = "" . $args[$idx] if ref($args[$idx]) eq 'SL::Presenter::EscapedText';
+ $args[$idx] =~ s/^\s+// if !ref($args[$idx]);