in reply to Array undefining istelf?
if ( ! defined $sof_i[2] ) { print "There is no data in the ISTAT file\n"; print "The RTS/DPS monitor is down.\n"; close PAGE; system( @sendpage ); exit(1); } my %month = ( Jan => 0, Feb => 1, Mar => 2, Apr => 3, May => 4, Jun => 5, Jul => 6, Aug => 7, Sep => 8, Oct => 9, Nov => 10, Dec => 12, ); my @units = ( qw(day month date hour minute second year) ); get_i(); sub get_i { pop @sof_i if $sof_i[-1] =~ m/={30}/; for my $thing ( reverse @sof_i ) { last if $thing =~ /^={30}/; my (%time_units, %time_con_units); if ( $thing =~ /(^\D{3}) (\D{3})\s+(\d{1,2}) (\d{2}):(\d{2}):( +\d{2}):(\d{2}) (\d{4}) sw_eof \[.+\]/ ) { my @vals = ($1, $2, $3, $4, $5, $6, $7); if ( $thing =~ /try/ ) { @time_units( @units ) = @vals; } elsif ( $thing =~ /connected/ ) { @time_con_units( @units ) = @vals; } } my $i_socket_status; if ( $thing =~ /EOF Socket Status/ ) { ($i_socket_status) = $thing =~ /\[(.*)\]/; } $sof_to_delete++; # If this can not be seen in scope, it sho +uld be passed to the sub for my $blah ( reverse 1 .. $sof_to_delete ) { pop @sof_i; my $i_num_month = substr($time_units{month}, 0, 3); $time_units{month} = $month{ $i_num_month }; my $i_sof_time = timegm( @{time_units}{ qw(second minute h +our date month year) }; } if ( ! defined $i_sof_time ) { print "I did not find any connection attempts in the istat + file.\n"; print "RTS/DPS Monitor is down.\n"; close PAGE; system(@sendpage); exit(1); } } }
|
|---|