oddness in quotes (PerlMagick)

Discussion in 'Perl Misc' started by myicq, Nov 12, 2007.

  1. myicq

    myicq Guest

    I have done some experimenting with Perl Magick and
    unicode.

    I have found a very strange thing with quotes. Can someone explain the
    following:


    # this will fail, resulting in output
    # of literal string \x{0416}
    # using SINGLE quotes

    $image->Annotate(
    font=>'arial.ttf',
    text=>'\x{0416}');


    # this will work
    # resulting in a single character
    # using DOUBLE quotes

    $image->Annotate(
    font=>'arial.ttf',
    text=>"\x{0416}"
    );


    My question is: I thought Perl did not differ between single and double
    quotes, as long as used consistently in a string.

    Btw, using Windows version of Perl and GM.
     
    myicq, Nov 12, 2007
    #1
    1. Advertising

  2. myicq <4> writes:

    > I have found a very strange thing with quotes. Can someone explain the
    > following:


    'perldoc perlop' can explain it. Read the part starting with 'Quote
    and Quote-like Operators'.

    > My question is: I thought Perl did not differ between single and double
    > quotes, as long as used consistently in a string.


    No, double quotes interpolates while single quotes doesn't. Escape
    sequences are only available in quote constructs that
    interpolates. (most of them are also available in translitterations
    but that is not relevant here)

    //Makholm
     
    Peter Makholm, Nov 12, 2007
    #2
    1. Advertising

  3. myicq

    Uri Guttman Guest

    >>>>> "m" == myicq <4> writes:

    m> My question is: I thought Perl did not differ between single and
    m> double quotes, as long as used consistently in a string.

    where did you learn that? have you ever used interpolation in a perl
    string? it would make little sense to have both quote do the same thing.

    and as someone else pointed out, it is easy to look up quotes in the
    docs.

    uri

    --
    Uri Guttman ------ -------- http://www.stemsystems.com
    --Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
    Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
     
    Uri Guttman, Nov 12, 2007
    #3
  4. myicq

    T Guest

    Peter Makholm <> wrote in news::

    > myicq <4> writes:
    >
    >> I have found a very strange thing with quotes. Can someone explain the
    >> following:

    >
    > 'perldoc perlop' can explain it. Read the part starting with 'Quote
    > and Quote-like Operators'.


    THANK YOU for the detailed answer. Guess I learned an important lesson
    or two.. and first of all: RTFM before asking.

    Thank you again, also to other people that replied.

    My bad
     
    T, Nov 12, 2007
    #4
  5. myicq <4> wrote in news:Xns99E64A2A164C0myicqgmxnet@
    212.242.40.162:

    > I thought Perl did not differ between single and double
    > quotes, as long as used consistently in a string.


    perldoc perlop

    esp. "Quote and Quote-like Operators"

    Sinan


    --
    A. Sinan Unur <>
    (remove .invalid and reverse each component for email address)
    clpmisc guidelines: <URL:http://www.augustmail.com/~tadmc/clpmisc.shtml>
     
    A. Sinan Unur, Nov 12, 2007
    #5
  6. On 12 Nov 2007 06:17:31 GMT, myicq <4> wrote:

    >My question is: I thought Perl did not differ between single and double
    >quotes, as long as used consistently in a string.


    You thought wrong! See

    perldoc perlop


    Michele
    --
    {$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
    (($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
    ..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
    256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
     
    Michele Dondi, Nov 12, 2007
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chris White

    Quotes/Double Quotes in Image Control

    Chris White, Sep 22, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    4,905
    Hermit Dave
    Sep 22, 2004
  2. Chris
    Replies:
    1
    Views:
    13,744
    Oisin
    Mar 24, 2006
  3. Lawrence Tierney

    Multiline quotes - escaping quotes - et al

    Lawrence Tierney, Dec 24, 2003, in forum: Java
    Replies:
    3
    Views:
    4,541
    Andrew Thompson
    Dec 24, 2003
  4. jOhn
    Replies:
    1
    Views:
    266
    Phlip
    Jan 29, 2008
  5. Richard Sandoval
    Replies:
    5
    Views:
    228
    7stud --
    Apr 26, 2011
Loading...

Share This Page