Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Hi Strat,

What is happening here is related to the way that Perl looks at individual values (scalars) and lists of values (arrays.) When you are referring to the whole list, stored in @F, say in a foreach loop...

foreach $_(@F) # For each value in the list called @F { # Do stuff... }
...then you should use the @ prefix but when you want a single, discrete value within @F, such as $F[6], say in the following if clause...
if ($F[6]) # If the seventh individual value in @F is true { # Do stuff }

...then you should use $F[6]. Essentially, if you're trying to access a single value then you'll want $, a list of values @ and a hash of key/value pairs %. Type "perldata" into the search box at the top of any perlmonks page and hit the search button. This should explain all you wish to know.


Update : Apologies to all concerned, I completely misread the question in my eagerness to provide an answer. Please ignore the above. *Goes very red*

"What this book tells me is that goose-stepping morons, such as yourself, should read books instead of burning them."
       - Dr. Jones Snr, Indiana Jones and the Last Crusade]

In reply to @F[6] vs. $F[6] - The Wrong Answer by Elgon
in thread Autosplit-Mode and $F[6] vs @F[6] by strat

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 all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others studying the Monastery: (1)
    As of 2018-02-23 01:07 GMT
    Find Nodes?
      Voting Booth?
      When it is dark outside I am happiest to see ...

      Results (300 votes). Check out past polls.