use warnings;
use strict;
use 5.010;
my $FName = 'Rabindra';
my $LName = 'Nayak';
my $strlen = length $FName;
if ($strlen < 10) {
$FName = $FName . ( ' ' x (10 - $strlen) );
}
print "$FName$LName\n";
#or
my $Name = sprintf "%-*s%s", $strlen, $FName, $LName;
print "$Name";
use strict;
use 5.010;
my $FName = 'Rabindra';
my $LName = 'Nayak';
my $strlen = length $FName;
if ($strlen < 10) {
$FName = $FName . ( ' ' x (10 - $strlen) );
}
print "$FName$LName\n";
#or
my $Name = sprintf "%-*s%s", $strlen, $FName, $LName;
print "$Name";