in reply to Re: Scope of separator variable
in thread Scope of separator variable

Okay, thanks. Quick replies, wow. Still not used to having something like perldoc after C & C++ :) It is nice. Still unsure where to look in it half the time, though, so you might see a few more of these sorts of basic questions.

Replies are listed 'Best First'.
Re^3: Scope of separator variable
by roboticus (Chancellor) on Aug 06, 2014 at 17:44 UTC

    shadowSage:

    Be sure to familiarize yourself with the perl documentation (perldoc perltoc), and you'll have even faster responses!

    After all, for a lot of the basic questions, if you know where the answers are, you can look up the answer faster than you can type in the question!

    ...roboticus

    When your only tool is a hammer, all problems look like your thumb.

Re^3: Scope of separator variable
by AppleFritter (Vicar) on Aug 06, 2014 at 17:56 UTC

    That's fine, nothing wrong with asking basic questions. And I agree, it can be difficult to find the right perldoc page when you don't already know what to look for. But do take a look at perldoc.perl.org; it's fairly well-organized, as well as searchable (though unfortunately not for tokens like $").

    If you're serious about Perl programming, I'd also recommend picking up a copy (or getting your employer to pick up a copy) of Programming Perl, aka "The Camel". It's an excellent, must-have book, and it has a big reference section.

    There's even a chapter on special variables, which also provides a clear and concise answer to your original question (p. 655 in the third edition):

    Program-wide Special Variables

    These variables are truly global in the fullest sense -- they mean the same thing in every package, because they're all forced into package main when unqualified (except for @F, which is special in main, but not forced). If you want a temporary copy of one of these, you must localize it in the current dynamic scope.

    [...]
    $" ($LIST_SEPARATOR)
    [...]

    There's gentler introductions to Perl if you're new to it, but as a general reference, it's invaluable.

      Yeah, hard to search for something like $", most things won't parse that properly. Thanks for the advice and recommendations. I have Learning Perl and Intermediate Perl. I was looking at Programming Perl, though it seemed more reference-like than the others, and so I presumed it would be more useful after I got to know things a bit better. I'll go pick it up tomorrow, I think the copy I ordered of mastering perl should be there too (it'll be a bit before I get to that one, but, still, nice to have). Thanks everyone.
      Do not hesitate to write in your books. Highlight the solution to problems you are likely to have again. Add items to the index when you find them. Cross-reference similar features. Add references to perldoc to document details and/or changes.
      Bill
Re^3: Scope of separator variable
by Anonymous Monk on Aug 06, 2014 at 18:43 UTC

    From the command line you can use perldoc -v '$"' (doesn't work on older Perls), and all the other special variables are documented in perlvar. Also very helpful is perldoc -f functionname, which will even point you in the right direction if you ask it e.g. perldoc -f for