what does your code do? Let's see.
while (<'FILE'>) { $gline = <'FILE'>; print $gline; }

Line 1. while(<'FILE'>)

The <> operator takes a chunk of input from a filehandle, and assigns it to a variable. In this case, to $_, our favorite line noise default variable. So you have said, 'While you can pull a hunk of data out of FILE and stick it into $_, do some stuff.'

Line 2. { $gline = <'FILE'>;

Again with <>. This time you're explicitly assigning to $gfile. To translate into english, 'Put the next hunk of data you get from FILE into $gline.'

Line 3.  print $gline;

Simply print the contents of $gline, which in this case is the even lines of your file.
Try this code ;)

while (<FILE>) { $gline = <FILE>; push @even, $gline; } seek FILE, 0,0; do { $gline = <FILE>; push @odd, $gline; } while (<FILE>); foreach(0..$#odd) { print $odd[$_], $even[$_]; }


TGI says moo


In reply to Re: Reading HTML? by TGI
in thread Reaped: (duplicate) Reading HTML? (delete) by NodeReaper

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.