Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

davorg (18)

davorg
  dave@dave.org.uk
http://dave.org.uk/
Yahoo! ID: daveorguk (Add User, Send Message)

Hacker, author, trainer

Technorati Profile [technorati.com]

Journal of davorg (18)

Monday June 21, 2004
02:46 AM

Perl's Special Variables

[ #19402 ]

My article on Perl's special variables[1] was published on perl.com over the weekend.

I've already had a couple of email from people telling me how useful they've found it. Always nice to know your work is appreciated.

[1] Actually it just covers half a dozen or so variables that control file I/O.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • No discussion of $. would be complete without a mention of multiple commandline ARGV filenames -- $. does not reset between files, unless

    close ARGV  if eof;

    or equivalently,

    close ARGV  if eof(ARGV);

    is included in the

    while(<>)

    loop.

    eof(3) [perldoc.com]

    Otherwise excellent review!

    --
    Bill
    # I had a sig when sigs were cool
    use Sig;
  • Just spotted a minor typo in the article and I thought I'd tell you so that you might be able to update it.

    The string that separates the elements of an array when expanded in a double quoted string is stored in $". Once again, it's simple to change it to a different value.

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

        print "@arr";
      }

    This code prints 1+2+3".

    That final quotation mark shouldn't be there. :)

    Otherwise a very good article.

    All the best,

    jarich

  • To be honest, I missed the -l switch on command line for triggering $\ to a default newline character. Beside that, Excellent article!
  • I had wanted to email you about it, but I'm pretty timid. It's a fantastic article, now if I can only remember those goodies. :) Thank you!