>Oh. So you're saying that there is no way to store a filehandle in a variable then. (Or at
To which I say, you are getting what you ask for. If you want the contents of $x twice use the x operator.

> but hey, if you say it's "obvious"...
Please note I said *seemed* obvious. As in I was running through a thought process and then comparing against perl's actual behavior.

>This function works just fine, printing to stdout, until one day you forget and open a
>filehandle named X in some completely separate part of the program, and then suddenly
This is not the same, it is not a scalar filehandle.

UPDATE: This is a read-only value, clearly perl could be smart-enough to recognize that read-only values which are not STDERR, STDIN, or STDOUT as not a filehandle.

perl -e '$a= \"a"; ${$a}.="s"; print ${$a}' Modification of a read-only value attempted at -e line 1.

--
perl -pe "s/\b;([st])/'\1/mg"


In reply to Re$i: Perl's Bad Ideas by belg4mit
in thread Perl's Bad Ideas by japhy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.