#!/usr/local/bin/perl -w use strict; use File::Basename; use Env; my (%SITREP, $param, $value, @SORTME); my $script = "$HOME/DSC/bin/checkDisplayBatch"; my $base = basename($script); my $c = 0; eval { $SIG{ALRM} = sub { print "Timeout during operation!\n"; exit(5); }; }; open(CDB,"$script |"); # Set a timeout value so that it doesn't hang! alarm(30); while ( ) { chomp; die("$base failed probably due to the X25 link being saturated right now.\n". "Try again in a moment...". "Dump from $script: $!\n\n") if ( /ERROR/ ); next if ( /-/ ); if ( /AMA/ or /STATUS/ ) { push(@SORTME,split(/\|/)); } } # So far this is the beginning of my implementation # of what I want to do. This is the code (partly # tweaked now) that gave the above output of data # that I am working with. This, in other words, is # where my work, I think, needs to be worked on more. # There is some code in here that I have just placed # to test and I know it will not totally work. Just # disregard that, please ;) map { $_ =~ s/\s//; # print $c++ ." : $_\n"; <-- obviously this is the code # that gave us the above output if ( /\w/ ) { ($param,$value) = split(/:/); $value =~ s/\s+//g; $array[$c] = ($SITREP{$param} = $value); if ( $value eq "CLOSED" ) { print ""; } } else { $c++; } } @SORTME;