Text Formatting and Date Strings
Join Templates
Join fixed text fields with a selected separator.
Join Templates
join_templates.pl
use strict;
use warnings;
my $style = ;
my $separator = "-";
if ($style eq "slash") {
$separator = "/";
} elsif ($style eq "colon") {
$separator = ":";
}
my $year = "2026";
my $month = "04";
my $day = "15";
my $date = join($separator, $year, $month, $day);
print "style=$style\n";
print "separator=$separator\n";
print "date=$date\n";
use strict;
use warnings;
my $style = ;
my $separator = "-";
if ($style eq "slash") {
$separator = "/";
} elsif ($style eq "colon") {
$separator = ":";
}
my $year = "2026";
my $month = "04";
my $day = "15";
my $date = join($separator, $year, $month, $day);
print "style=$style\n";
print "separator=$separator\n";
print "date=$date\n";
use strict;
use warnings;
my $style = ;
my $separator = "-";
if ($style eq "slash") {
$separator = "/";
} elsif ($style eq "colon") {
$separator = ":";
}
my $year = "2026";
my $month = "04";
my $day = "15";
my $date = join($separator, $year, $month, $day);
print "style=$style\n";
print "separator=$separator\n";
print "date=$date\n";
join-templates
`join` creates predictable text from ordered fields.