bear with me here, I'm new to SQL and DBI, and I've never really used "strict" until now. I want to put my database variables (servername, serverdb, serverpass, etc) as global variables at the top of my main script. so i have a setup like this:

#!/usr/bin/perl -Tw use strict; use CGI ":all"; our $serverName = "blahblahblah"; our $serverDB = "blahblahblah"; our $serverUser = "blahblahblah"; our $serverPass = "blahblahblah"; our $db = "DBI:mysql:$serverDb:$serverName"; print header, "test";

but it of course gives an error, only where i try and put a variable in the string. So I try and concatinate it as such:

our $db = "DBI:mysql:".$serverDb.":".$serverName;
but that too returns an error. In fact, the only way i could get all of this to work is if I did the following:
my $x = "DBI:mysql:"; my $y = ":"; our $db = $x.$serverDb.$y.$serverName;
I dont want to slap every petty string into a variable if I want to do something like this, but what else can I do? EDIT: My god, I'm a moron. Thanks, guys *sigh*

In reply to "use strict;" woes by toonski

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.