my $esc_char = get_escape_case("S"); #### my $case_formatted_string = $esc_char ."FoobAr"; #### use strict; # determine case of a character # and return appropriate 'control' code. sub get_escape_case { my ($char) = @_; if ($char eq "\U$char") { return '\U'; } else { return '\L'; } } # this wouldn't work... print get_escape_case("S")."stuff\n"; # while this works.. print "\Ustuff\n";