237 : AMAFILE: AMA210 238 : STATUS: NETWORK 239 : DATE CREATED: 9/20/01 240 : 241 : AMAFILE: AMA211 242 : STATUS: NETWORK 243 : DATE CREATED: 9/20/01 244 : 245 : AMAFILE: AMA212 246 : STATUS: NETWORK 247 : DATE CREATED: 9/20/01 248 : 249 : AMAFILE: AMA213 250 : STATUS: CLOSED 251 : DATE CREATED: 9/20/01 252 : 253 : AMAFILE: AMA214 254 : STATUS: OPEN 255 : DATE CREATED: 9/20/01 #### $myarray[253] = ( $myhash{AMAFILE} = "AMA214"; $myhash{STATUS} = "OPEN"; $myhash{DATE CREATED} = "9/20/01"); #### #!/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;