Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Best practice on escapes in interpolated strings

by wanna_code_perl (Friar)
on Jul 29, 2013 at 11:01 UTC ( [id://1046837]=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
        $obj->print(sprintf("Page %d - Section %d - %s",
                                  $obj->current_page,
                                  $obj->section->num,
                                  $obj->section->name,
                               )
                       );
    
  2. or download this
        BEFORE   | AFTER  | COMMENT
    -------------+--------+----------------
    ...
                 |        | in double quotes
      '\\^(foo)' | \^(foo)| Confused with '\BAR'?
      "\\^(foo)" | ^(foo) | Double quotes
    
  3. or download this
        BEFORE   | AFTER  | COMMENT
    -------------+--------+----------------
    ...
      '^ ^(foo)' | ^ BAR  | No need to escape
                          | ^ unless part of
                          | ^(foo) match.
    
  4. or download this
        BEFORE   | AFTER  | COMMENT
    -------------+--------+-----------------
    ...
                          | part of pattern
    '^(^)^(foo)' | ^BAR   | Explicit escape
    '^^(^)(foo)' | ^^BAR  | Or ^(^)^(^)^(foo)
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1046837]
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2024-04-16 06:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found