I sometimes need two string variables, where the value of the second one is derived from the first one by character substitution.
Is there a more concise way to do it than shown below? Taking two separate commands for defining the second var from the first is bug-prone and cumbersome:
# Example: "pstopdf" and "ps2pdf":
my $name1 = "pstopdf";
my $name2 = $name1;
$name2 =~ s/to/2/;
1 Answer