Since you are new to Perl, I can offer some advice about the code at the top of your script, namely:

$SYS_NAME=`uname -s`; if ($SYS_NAME =~ "AIX") { $SYS_TYPE=1; `/usr/bin/df -k | /usr/bin/sort +6 >$FILE`; } # ...
First, I don't see how the $FILE variable is set to a value. Having said that, you probably don't need this variable at all because you can capture the command stdout directly to a Perl variable without bothering to save it to an intermediate file. Second, you can use the Perl built-in $^O variable to determine what system you are running on without needing to run the external uname command. Finally, it is good practice to always check the return code any time you run an external command. To illustrate the above points with some code:
my @df_stdout; if ($^O =~ /aix/i) { $SYSTYPE=1; @df_stdout = `/usr/bin/df -k | /usr/bin/sort +6`; my $rc = $? >> 8; $rc == 0 or die "error: df command failed, rc=$rc"; } # ... for (@df_stdout) { # Put your while loop body here... }
Note further that you can replace:
for (@df_stdout) {
above with:
for my $line (@df_stdout) {
to use an explicit variable ($line) rather than relying on $_.

As for resources for learning Perl, I suggest you start by visiting learn.perl.org. And, as described in detail above by ELISHEVA, you should start all your scripts with use strict and use warnings.


In reply to Re: Newbee to Perl and the error by eyepopslikeamosquito
in thread Newbee to Perl and the error by darsh123

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.