Question about delimiters.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • starlight849
    New Member
    • Jun 2009
    • 82

    Question about delimiters.

    I'm using the printf function to display some textual information. It is possible that the string may contain different symbols such as $#%^&* somewhere within the text.

    I know that to handle the % that I need to use a %% to make the string evaluate correctly.
    for example:
    Code:
    printf "strin%%g";
    will display as strin%g

    My question is are there any other symbols that will give me issue using printf like % does? and if so, how do I handle them?


    Thanks so much!
  • RonB
    Recognized Expert Contributor
    • Jun 2009
    • 589

    #2
    I know that to handle the % that I need to use a %% to make the string evaluate correctly.
    That would not work in Perl. Perl uses the backslash to escape special chars.

    Why are you using printf without a format specification?

    If you don't need to use a format, then use print instead of printf.

    If you don't what to interpolate, then use single quotes instead of double quotes.

    Comment

    • sathishkumar88
      New Member
      • Jan 2012
      • 4

      #3
      This can be useful for you
      use strict;
      use warnings;
      print "strin\%g";

      Comment

      Working...