update: I knew I was posting with too much zeal lately. Just a great way to show what you don't know (or think you do). See tye's comment below for the real deal.

btrott beat me to it, but I can add that or works because of precedence. You see, as everyone has said, the problem is that when the right side of the || get evaluated the handle doesn't exist yet because the my hasn't done it's magic yet. Using or avoids this because it's less important in terms of its precedence and therefore let's my do its thang (no typo) before checking out what it has to - and now $dbh does exist and can be checked. see perlman:perlop to read about the || and or operators and their respective precedence.

<myExperience> $mostLanguages = 'Designed for engineers by engineers.'; $perl = 'Designed for people who speak by a linguist.'; </myExperience>

In reply to RE: RE: my and its use by jptxs
in thread my and its use by tame1

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.