Loading ...
Sorry, an error occurred while loading the content.
 

Creating a string with variables and contants

Expand Messages
  • Jon Morris
    I need to create a string that contains both the values from variables and constants. How do I indicate where the variable value name ends and the contant
    Message 1 of 1 , Dec 16, 2004
      I need to create a string that contains both the values from variables and constants. How do I indicate where the variable value name ends and the contant begins? Here is what I am trying to do.

      $ver = "1.2";
      $trans = "100";

      $command = "WV$verLM$trans";

      My required output is 'WV1.2LM100'. Of course right now my output is WV100 because perl is trying use the variable $verLM.
      I tried to escape the L by trying:

      $command = "WV$ver\LM$trans";

      This returned an interesting string; 'WV12m100". Looks like the \L changed the M to lowercase.

      Can anyone help me get the correct output for my string?

      Thanks in advance,
      Jon
    Your message has been successfully submitted and would be delivered to recipients shortly.