Hi... I have a Perl Script which will extract statistics from DB2 database. But when i try to run it using ./filename.pl It ends up with --> syntax error at ./run_db2look.pl line 61, at EOF Execution of ./run_db2look.pl aborted due to compilation errors (#1) Do i need to pass the parameters from the beginning. Plz provide me an solution.

#!/usr/bin/perl -w # use Getopt::Std; use Time::Local; use diagnostics; use warnings; getopt('d:', \%params); my $database = uc($params{"d"}); die "Usage: $0 -d <database>" unless ($database); my $result; $/ = undef; #connect db $result = `db2 connect to $database`; die "$0: Cannot connect to database $database.\n$result" unless ($? + eq 0); #run db2 command $result = `db2 "select tabname from syscat.tables where STATS_TIME +>= TRUNC(current timestamp) - 7 days and TABSCHEMA = 'TCSUPER'"`; my $close = `db2 connect reset`; die "$0: Cannot close connection to database $database.\n$close" un +less ($? eq 0); `db2 terminate`; # print current timestamp my $now = `date`; print "$now\n"; @records = split(/\n/, $result); ## removing last element in array. my $retval = pop(@records); $cnt = 1; $table_list = ""; foreach my $record (@records) { ## remove headers in the results if ($cnt > 3 ) { #trim white spaces $record =~ s/^\s+//; $record =~ s/\s+$//; if (length($record) > 0 ) { print "$cnt : |$record| " . length($record) . "\n"; $table_list .= " " . $record; ##print "$table_list\n"; } } $cnt++; } print $table_list; #excute db2look from the table lists `db2look -d tcard -m -t $table_list -o dl.out`; exit; ~

In reply to Compilation Error by ai_zaviour

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.