I'm trying to let the user put in the times they are trying to get Db info for and I keep getting the error message below. I don't know how to fix. User Input is in sub routine GetAlarmInfo. Error Message: Can't use string ("10") as a symbol ref while "strict refs" in use at quenchNotifLogTable1.pl line 61.
#! /usr/local/bin/perl -w # A perl program to analyze the notifAlarmLog Table and quench times use FileHandle; use IPC::Open2; use Symbol; # use Tk; use Sybase::CTlib; use Time::Local; use strict; my(%dispatch) = (); my(%systemNames); systemNames(); # fill in the hash of PS system names my $dbAlarms = new Sybase::CTlib 'harmless','harmless','OPSYB1','notif +LogTable'; $dbAlarms->ct_sql("use TomTest"); %dispatch = (help =>\&Help, info =>\&GetAlarmInfo); my $numberOfArgs = @ARGV; if($numberOfArgs == 0) { Help(); exit 1; } my($what) = shift(@ARGV); my($whatLower) = $what; $whatLower =~ tr/[A-Z]/[a-z]/; if ($what eq undef) { Help(); exit 1; } if(exists($dispatch{$whatLower})) { &{$dispatch{$whatLower}}(@ARGV); exit 0; } Help(); exit; sub GetAlarmInfo { use strict; #Given a time in (X) seconds find the number of Alarms occurring for + each PS #Given a time in seconds find the number of Alarms occurring w/in (Y +) seconds AFTER a Quench Event for each PS #Both sorted by number of occurrences my $sql = "SELECT distinct name FROM notifAlarmLog"; my $NameCount = 0; # count number of PS my(@rows,$row); @rows = $dbAlarms->ct_sql($sql); foreach $row (@rows) { $NameCount++; # see how many power supplies there are $sql = "SELECT * FROM notifAlarmLog WHERE name like '$row->[0]'"; my($supply,@supplies); @supplies = $dbAlarms->ct_sql($sql); # count all alarms for each PS my $count = @supplies; # count how many alarms occur within user specified time given in +seconds my $AlarmCount = 0; # count how many alarms occur w/in (X) seconds after a QUENCH EVEN +T (user specified in seconds)? my $QuenchCount = 0; # work done here!!! my $AlarmFilter = $_[0]; if ($AlarmFilter >= 0) { my $QuenchFilter = $_[1]; foreach $supply (@supplies) { $AlarmCount++ if(($supply->[4] - $supply->[3]) <= <$AlarmFilter>) +; #Line 61 my $dbEvents = new Sybase::CTlib 'harmless','harmless','OPSYB1','f +illeventsT'; $dbEvents->ct_sql("use rhic_au_fy01_fill"); my $sql = "SELECT * FROM fillEventsT WHERE rhicTime like 'Oct%' and (event like 'ev-bque +nch' or event like 'ev-yquench')"; my(@fills,$fill); @fills = $dbEvents->ct_sql($sql); foreach $fill (@fills) { # how many alarms occur w/in 10 seconds a +fter a QUENCH EVENT? $QuenchCount++ if(($supply->[3] - $fill->[0]) <= <$QuenchFilter> +) and (($supply->[3] - $fill->[0]) > 0); } } } #filter out alarms that occur w/in 10 seconds after a Quench EVENT my $diff = $count - $QuenchCount; my ($f1,$adoName,$f3) = split(":",$row->[0]); my $SiteWideName = $main::systemNames{$adoName} . ":$f3"; # print ":$adoName: :$SiteWideName: \n"; print "$SiteWideName, $AlarmCount, $count, $QuenchCount, $diff \n" +; } print "There were $NameCount Power Supplies that alarmed in Oct. 200 +1. \n"; } sub systemNames { # fill in the systenName hash use strict; my $dbAdo = new Sybase::CTlib 'harmless','harmless','OPSYB1','notifL +ogTable'; $dbAdo->ct_sql("use serverAdo"); my $sql = "SELECT name,systemName from adoInst where name like 'psWa +tch%'"; my(@rows,$row); @rows = $dbAdo->ct_sql($sql); foreach $row (@rows) { $main::systemNames{$row->[0]} = $row->[1]; # print "<$row->[0]> <$row->[1]> \n"; } } sub Help { #display help for this tool print "Alarm and Quench Tool- A program for user to input times in +seconds to: \n 1. Exclude Alarms that last LESS THAN <X> seconds. \n 2. Exclude Alarms that occur within <Y> seconds AFTER a Quench. \n Both are sorted by number of occurrences \n List of Commands: <Info> Given the times in seconds, find the number of occurrencs + for Alarms and for Alarms after a Quench. Enter in form: XX YY \n"; }

In reply to help with user inputs by cjacksonjr

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.