BTW, the split is more 'correctly' written as:
     my ($port, $sname, $rem) = split /\t/;

Uh... there is nothing wrong with split("\t"). To quote Camel 2 (note that this is different from our own docs for split):

  The /PATTERN/ argument may be replaced with an expression to specify patterns that vary at run-time. (To do run-time compilation only once, use /$variable/o.) As a special case, specifying a space " " will split on whitespace just as split with no argument does. Thus, split(" ") can be used to emulate awk's default behavior, whearas split(/ /) will give you as many null initial fields as there are leading spaces. (Other then this special case, if you supply a string instead of a regular expression, it'll be interpreted as a regular expression anyway.)  

My point, runrig, is TIMTOWTDI, and that sometimes the 'correct' way isn't the way the programmer wanted to do it. I, for one, like to use quotes around constants that I am splitting on, and slashes for things that look more like regular expressions. Yeah, I know they are the same, but quotes around strings looks better (to me) then slashes.


In reply to RE: Re: Where oh where should I initialize my vars? by Adam
in thread Where oh where should I initialize my vars? by Guildenstern

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.