|
$sub = "(\w)";
$sub_with = "\U$1";
$text = "Hi hi, i am here.";
$text =~ s/(\w)/\U$1/gi; #this works.
$text =~ s/$sub/$sub_with/gi;#this doesnt work.
#does anybody know why?
|
|
|
#got the answer, it is:
#!/usr/bin/perl
$text = $text2 = "Hi hi, i am here.";
$sub = '(\w)';
$sub_with = '\U$1';
$text =~ s/(\w)/\U$1/gi;
eval("\$text2 =~ s/$sub/$sub_with/gi");
print STDOUT "";
|
|
|
|
|
|
|
// |