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

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!