Hello, I am getting following error in my first script.
shell.pl" 59 lines, 1470 characters daahpdev: dev/home/rvaishna$ perl shell.pl Scalar found where operator expected at shell.pl line 46, at end of li +ne (Missing operator before ?) syntax error at shell.pl line 46, near ") $FSUSED " Unmatched right bracket at shell.pl line 59, at end of line syntax error at shell.pl line 59, near "}" Execution of shell.pl aborted due to compilation errors.
And the Script is mentioned below:
$SYS_NAME=`uname -s`; if ($SYS_NAME =~ "AIX") { $SYS_TYPE=1; `/usr/bin/df -k | /usr/bin/sort +6 >$FILE`; } elsif ($SYS_NAME =~ "HP-UX") { $SYS_TYPE=2; `/usr/bin/bdf -i >$FILE`; } elsif ($SYS_NAME =~ "Linux") { $SYS_TYPE=3; `/bin/df -kP >$FILE`; } else { print "Unknown system: $SYS_NAME."; exit -1; } open (DF, $FILE) || die "Can't Open File: $FILE\n"; while (defined ($_ = <DF> )){ ################################################################### +######## # AIX ################################################################### +######## if ($SYS_TYPE == 1){ ($FS, $BLOCKS, $FSFREE, $FSUSED, $IUSED, $PIUSED, $MOUNT) = spli +t; $FSUSED=~s/([0-9])\%/$1/; $PIUSED=~s/([0-9])\%/$1/; } ################################################################### +######## # Every OS ################################################################### +######## if ($MOUNT eq "\/") { $FS = "Root" } elsif ($FS=~/:/) { $FS1 = "NFS from " . $FS; $FS=$FS1 } if ($FSUSED >= 90) $FSUSED = "*$FSUSED*"; } if ($PIUSED > 60) { $PIUSED = "*$PIUSED*"; } if ($BLOCKS ne "Size (MB)") { $BLOCKS /= 1024 }; if ($FSFREE ne "Free (MB)") { $FSFREE = int ($FSFREE /= 1024) }; if ( (not $MOUNT=~"\/u\/") && (not $MOUNT=~"Mounted") || ($FS=~"NFS +") ) { printf "%-38s %-9d %-9d %-7s %-7s %-11s\n",$MOUNT, $BLOCKS, $FSF +REE, $FSUSED, $PIUSED, $FS; } }

In reply to 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.