This worked perfectly!! I am studying the code right now. I understand the majority of it. I have one question though...

Code for reference:

1 #!/usr/local/bin/perl 2 3 use strict; 4 5 my $max = 0; 6 7 sub readfile { 8 my $fn=shift; 9 my @ar; 10 11 open IN,"<$fn" || die "Couldn't open '$fn': $!"; 12 ## snarf the header 13 scalar <IN>; 14 ## read the rest 15 while (<IN>) { 16 chomp; 17 push @ar,$_; 18 $max = $_ if $_ > $max; 19 } 20 close IN; 21 22 @ar; 23 } 24 25 26 ## load the files into arrays 27 my @a=readfile 'f1.lst'; 28 my @b=readfile 'f2.lst'; 29 my @c=readfile 'f3.lst'; 30 31 ## iterate until all arrays are empty 32 for (my $i = 0; $i <= $max; $i++) 33 { 34 next unless $a[0] == $i || $b[0] == $i || $c[0] == $i; 35 36 ## print them out (if they match) 37 printf "%5s", $a[0]==$i ? scalar shift @a : undef; 38 print " | "; 39 printf "%5s", $b[0]==$i ? scalar shift @b : undef; 40 print " | "; 41 printf "%5s", $c[0]==$i ? scalar shift @c : undef; 42 43 print "\n"; 44 }
My only question is: In lines 36-41 you have a snippet  scalar shift @array. What is this doing? :) Thank you very much!!

----------
- Jim


In reply to Re: Re: Printing out multiple array lists and more! by snafu
in thread Printing out multiple array lists and more! by snafu

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.