I would like to use perl code in my config file. I am not able to make this work when using strict, warnings and declaring variables.

Can someone look at my config file and my script and tell me what I need to do to get this to work properly

Script
use warnings; use strict; my ($scalarone,$scalartwo,$scalarthree,$scalarfour,$scalarfive,@arrayo +ne,@arraytwo,%hashone); use lib("/tmp"); do "config.cfg"; print << "PRINT"; ######################################## Scalarone is $scalarone ######################################## Scalartwo is $scalartwo ######################################## Scalarthree is $scalarthree ######################################## Scalarfour is $scalarfour ######################################## scalarfive is $scalarfive ######################################## Arrayone is @arrayone ######################################## Arraytwo is @arraytwo ######################################## Hashone one is $hashone{ONE} Hashone two is $hashone{TWO} Hashone three is $hashone{THREE} Hashone four is $hashone{FOUR} Hashone five is $hashone{FIVE} ######################################## PRINT

Config file
# Scalar Variables $scalarone = "one"; $scalartwo = "two"; $scalarthree = "three"; $scalarfour = "four"; $scalarfive = "five"; # Array Variables @arrayone = ('one', 'two', 'three', 'four', 'five'); @arraytwo = ('six', 'seven', 'eight', 'nine', 'ten'); # Hash Variables %hashone = ( ONE => 'one', TWO => 'two', THREE => 'three', FOUR => 'four', FIVE => 'five');

Thanks for your help

I got 99 problems, but a @%$()_ ain't one.

In reply to Moving variables to config file by monk2b

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.