Everytime I run this script it outputs only half of the information from the input file. (Skips every other "block"). I have included the input file and code below. I know I must be doing something wrong but I don't know what.
my $curpos = -1; my $curpos1 = -1; my $curpos2 = -1; my $curpos3 = -1; my $cur = -1; open (QUOTAOUT, ">D:\\Home.txt") || die "Can't open output file."; $file = "Home01.txt"; chomp ($file); open (QUOTA1, "D:\\Home01.txt") || die "Can't open file."; while (defined ($file = <QUOTA1>)) { $quota = <QUOTA1>; next if ($quota eq ""); @quota = split(/\t/, $quota); @quota[1] =~ s/^\://; @quota[1] =~ s/^\s+//; next if (@quota[0] eq "Used(%)"); if (@quota[0] eq "Object") { @quota[1] =~ tr/A-Z/a-z/; @uidt = split(/\\/, @quota[1]); chomp (@uid[2]); @uidt[2] =~ s/\W.*//; $curpos = $curpos + 1; $curpos3 = $curpos3 + 1; @uid[$curpos] = @uidt[2]; @path[$curpos3] = @quota[1]; next; } if (@quota[0] eq "Quota") { @quotast = split(/\s/, @quota[1]); chomp (@quotast[0]); @quotast[0] =~ s/\W.*//; $curpos1 = $curpos1 + 1; @quotas[$curpos1] = @quotast[0]; next; } if (@quota[0] eq "Current") { @usaget = split(/\s/, @quota[1]); chomp (@usaget[0]); @usaget[0] =~ s/\W.*//; $curpos2 = $curpos2 + 1; @usage[$curpos2] = @usaget[0]; next; } } close QUOTA1; chomp (@path); foreach $uid(@uid) { $cur = $cur + 1; print QUOTAOUT "Usage for $uid is @usage[$cur] bytes. Quota is @quotas[$cur] bytes. Server is lnxdayhome01. Path is @path[$ +cur]\n";
}
Begin Input File: Object : T:\HD1\UDENTJP Quota : 250000000 Bytes Current : 0 Bytes Used(%) : 0% Object : T:\HD1\UDEPAML Quota : 250000000 Bytes Current : 336821 Bytes Used(%) : % Object : T:\HD1\UDERRTX Quota : 250000000 Bytes Current : 70095734 Bytes Used(%) : 28% Object : T:\HD1\UDESCJT Quota : 250000000 Bytes Current : 81945 Bytes Used(%) : % Object : T:\HD1\UDETELX Quota : 250000000 Bytes Current : 229442791 Bytes Used(%) : 92% Object : T:\HD1\UDEUTGB Quota : 250000000 Bytes Current : 81945 Bytes Used(%) : % Object : T:\HD1\UDEVIR1 Quota : 250000000 Bytes Current : 0 Bytes Used(%) : 0% Object : T:\HD1\UDIDLRX Quota : 250000000 Bytes Current : 140305441 Bytes Used(%) : 56% Object : T:\HD1\UDIETRD Quota : 250000000 Bytes Current : 53772515 Bytes Used(%) : 22% Object : T:\HD1\UDIFRBX Quota : 250000000 Bytes Current : 63196422 Bytes Used(%) : 25% Object : T:\HD1\UDIGGSX Quota : 250000000 Bytes Current : 32722470 Bytes Used(%) : 13% Object : T:\HD1\UDILLBX Quota : 250000000 Bytes Current : 98329 Bytes Used(%) : % Object : T:\HD1\UDILLJ1 Quota : 250000000 Bytes Current : 111969540 Bytes Used(%) : 45% Object : T:\HD1\UDINELM Quota : 250000000 Bytes Current : 23118920 Bytes Used(%) : 9% Object : t:\HD1\UDIXOA1 Quota : 250000000 Bytes Current : 0 Bytes Used(%) : 0% Object : T:\HD1\UDIXOMD Quota : 250000000 Bytes Current : 4518573 Bytes Used(%) : 2%
End Input File

Thanks

In reply to Skipping lines by Anonymous Monk

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.