Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Quote and Quote-like Operators

by Xiong (Hermit)
on Dec 15, 2011 at 10:10 UTC ( [id://943683]=perlmeditation: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    say      'Cwm fjordbank glyphs vext quiz.';
        #:Cwm fjordbank glyphs vext quiz.
    
  2. or download this
    say      'a\'b\'c';
        #:a'b'c        
    say     q|a'b'c|;
        #:a'b'c
    
  3. or download this
    say    '\a';
        #:\a
    ...
        #:\a
    say   q|\\|;
        #:\
    
  4. or download this
    say     q|a'b'c|;   # ||
    say     q(a'b'c);   # ()
    ...
    say     q/a'b'c/;   # //
    say     q*a'b'c*;   # **
        #:a'b'c
    
  5. or download this
    say     '';     # empty string?
    say     q||;    # clearer
    say     ' ';    # single space?
    say     q| |;   # clearer
    
  6. or download this
    my $foo     = 'bar';
    say     "a-$foo-b";
        #:a-bar-b
    
  7. or download this
    say     qq|This\t('"')\tis a double-quote.|;
        #:This    ('"')    is a double-quote.
    
  8. or download this
    \t              tab
    \n              newline
    ...
    say     qq|a-\t-b-\n-c|;
        #:a-    -b-
        #:-c
    
  9. or download this
    say     <<'HERE';
    say qq|This\t('"')\tis a double-quote.|;
    ...
        #:say qq|This\t('"')\tis a double-quote.|;
        #:# my $string      = '\a\s\b';
        #:
    
  10. or download this
    my @ary     = ( 'Cwm', 'fjordbank', 'glyphs', 'vext', 'quiz' );
    my @ary     = qw| Cwm fjordbank glyphs vext quiz |;
    
  11. or download this
    my $regex       = 'a|b|c';
    my $string      = 'xxbxx';
    if ( $string =~ /$regex/ ) { say 'TRUE' } else { say 'FALSE' };
        #:TRUE
    
  12. or download this
    my $regex       = qr/a|b|c/;
    my $string      = 'xxbxx';
    if ( $string =~ /$regex/ ) { say 'TRUE' } else { say 'FALSE' };
        #:TRUE
    
  13. or download this
    my $regex       = '\s';
    my $string      = '\a\s\b';
    ...
    $regex          = quotemeta $regex;
    if ( $string =~ /$regex/ ) { say 'TRUE' } else { say 'FALSE' };
        #:TRUE
    
  14. or download this
    say     `date`;
    say     qx|date|;
        #:Thu Dec 15 01:19:30 PST 2011
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (2)
As of 2024-04-25 19:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found