Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

What does q{} mean?

by Wiggins (Hermit)
on May 19, 2016 at 18:14 UTC ( [id://1163513]=perlquestion: print w/replies, xml ) Need Help??

Wiggins has asked for the wisdom of the Perl Monks concerning the following question:

This clause has me stumped...
unless defined( $topic ) && ( $topic eq q{} || defined( _STRING( $topi +c ) ) ^^^^^
a string compare to a quoted nothing???

It is always better to have seen your target for yourself, rather than depend upon someone else's description.

Replies are listed 'Best First'.
Re: What does q{} mean?
by stevieb (Canon) on May 19, 2016 at 18:19 UTC
Re: What does q{} mean?
by Eily (Monsignor) on May 19, 2016 at 18:27 UTC

    ++stevieb

    This is also one of the cases where B::Deparse can help: perl -MO=Deparse -e 'print q{}' yields

    print ''; -e syntax OK
    The print statement is there to avoid the value being in void context and optimized away.

Re: What does q{} mean?
by Old_Gray_Bear (Bishop) on May 19, 2016 at 22:15 UTC
    A Google search (note: 'Google' is not a verb, it is a trade marked name like Kleenex or Xerox) isn't the right tool for this job. Try perldoc -f q for the real scoop on the q function.

    ----
    I Go Back to Sleep, Now.

    OGB

Re: What does q{} mean?
by choroba (Cardinal) on May 20, 2016 at 11:43 UTC
      In some fonts, '' and " are hard to distinguish.

      In which case might I humbly suggest that those fonts are entirely unsuitable for use in programming? See which fonts are popular for ideas regarding replacements.

Log In?
Username:
Password:

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

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

    No recent polls found