Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Welcome to the Monastery. Not sure how new a newbie you are... so I broke it down a bit
my # declare the variables in the local +scope (guarantees you won't overwrite a variable already in use or ca +pture a value already assigned) ($_configParam,$_paramValue) # A list of variable names that you a +re declaring, note that coma separated variables between parenthesis +are treated similarly to an array for assignment purposes = # and as you declare them you assign +them a value split( # a Perl function that splits strings + on the basis of a regular expression /\s*=\s*/ # the regular expression to use in th +e split. any number of space characters, followed by an equals sign f +ollowed by any number of space characters , $_ # The second part of the split state +ment, the string to be split $_ is the default variable, you will see + it a lot. , 2); # Limit the split to 2 values, close + the call to split and terminste the line with a semi-colon $configParamHash{$_configParam} # in an indexed list keyed on the par +ameter name = $_paramValue; # assign the value above to a hash en +try keyed on the parameter name
This is a common pattern used when reading through a configuration file to assign name value pairs in the file to an easily accessed indexed list.

print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."

In reply to Re: Perl Newbie by Utilitarian
in thread Perl Newbie by MaKha

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others studying the Monastery: (4)
    As of 2020-08-08 04:21 GMT
    Find Nodes?
      Voting Booth?
      Which rocket would you take to Mars?

      Results (51 votes). Check out past polls.