Is there a way to create a file that can be used by multiple scripts that contains only variables/constants other than by making them global and using "require"?
I have a set of SQL statments that I would like to bo able to put in a seprate file. Currently I have it embeded in my single script but a will be writing more scrpts hence the question.

Example of one of the SQL statments:
#! /usr/bin/perl -w use Date::Calc qw{Today Add_Delta_Days}; #needed to create date range in sql statments my $interval = -1; my ( $year, $month, $day ) = Today(); my ( $y_year, $y_month, $y_day ) = Add_Delta_Days( Today(), $interval ); my $tday = sprintf qq{'%s-%02d-%02d'}, $year, $month, $day; my $yday = sprintf qq{'%s-%02d-%02d'}, $y_year, $y_month, $y_day; # New Tickets by Date Range my $REPORT_BY_DATE = q{ SELECT p.value, id AS ticket, summary, status, component, version, milestone, t.type AS type, (CASE status WHEN 'assigned' THEN owner||' *' ELSE owner END) AS owner, strftime("%m/%d/%Y - %H:%M:%S", t.time, 'unixepoch') AS CreatedTime, c.value as Verified FROM ticket t, enum p, ticket_custom tc, ticket_custom c WHERE p.name = t.priority AND p.type = 'priority' AND t.type = 'defect' AND DATETIME(t.time, 'unixepoch')>= } . $yday . q{ AND DATETIME(t.time, 'unixepoch')<= } . $tday . q{ AND tc.ticket = t.id AND tc.name = 'story_card' AND t.status = 'new' AND c.ticket = t.id AND c.name = 'verified' ORDER BY id; };

In reply to Creating a library by dracos

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.