SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2008
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question How do I use special character $"

    $" This is the separator used between list elements when an array variable is interpolated into a double-quoted string. Normally, its value is a space character.


    When I try to use it I get an error because the double quote is interpreted as half of a set of double quotes. Is there an escape I am supposed to be using? Its hard to find anything on this with Google since it ignores punctuation.
    recipe for food
    hypnosis hypnotic trance
    directory pages

  2. #2
    SitePoint Enthusiast wordgeist's Avatar
    Join Date
    Oct 2009
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you are missing the underscore it should be $_ . for example:

    foreach (@foo) {
    print $_;
    }

  3. #3
    SitePoint Zealot Bompa's Avatar
    Join Date
    Feb 2008
    Posts
    179
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by 3ct7 View Post
    $" This is the separator used between list elements when an array variable is interpolated into a double-quoted string. Normally, its value is a space character.
    I don't know how or why you want to use the $", but you could change it if you want.

    my @arr = (1, 2, 3);
    {
    local $" = '+';

    print @arr;
    }

    http://www.perl.com/pub/a/2004/06/18/variables.html


    Bompa


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •