I'm using the null character (\0
) as a separator to keep the strings leading white-spaces after the sprintf
. But the strings with the null character don't work (in this case) with the Curses
addstr
function.
Is there some suitable character to replace the \0
for this purpose?
#!/usr/bin/env perl
use warnings;
use 5.12.0;
sub routine {
my @list = @_;
@list = map{ "\0".$_."\0"; } @list;
# ...
# ...
@list = map{ sprintf "%35.35s", $_ } @list;
# ...
# ...
my $result = $list[5];
$result =~ s/\A\s+\0//;
$result =~ s/\0\s+\z//;
return $result;
}