Perl's Special Variables

davorg on 2004-06-21T07:46:24

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.


$. and ARGV

n1vux on 2004-06-21T18:14:46

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)

Otherwise excellent review!

Minor typo in article

jarich on 2004-06-23T00:47:46

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

-l ?

Beatnik on 2004-06-24T11:03:46

To be honest, I missed the -l switch on command line for triggering $\ to a default newline character. Beside that, Excellent article!

Re:-l ?

davorg on 2004-06-24T11:06:22

There's a good chance that my next article will be about command line switches.

Great article...

Lunchy on 2004-06-28T21:18:15

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!

Re:Great article...

davorg on 2004-06-29T08:15:47

There's no need to be timid. Like most writers I love getting feedback on my work. I'm glad to hear that you found it useful.