After a lot of playing around with the above code, I ended up scrapping it and going with a Hash of Arrays instead. By doing this, I cut the time it takes to run by 50% (from 2:36 to 1:15). I don't have access to the code itself at the moment, so I will post my final copy of it tomorrow. And to answer fruiture's above reply, the @Messages array was something that I forgot to remove from the code that wasn't used until later on in the program itself.

Update: And as promised, here is the code for the entire program:
#!/opt/perl5/bin/perl -w use strict; my $Number; my $ln=@ARGV; if($ln<1 or $ln>1){ die "A single Store number is required!\n"; }else{ $Number=sprintf("%03d",$ARGV[0]); } ## Setup the Search Date ## my ($day,$month,$year)=(localtime(time-60*60*(12+(localtime)[2])))[3,4 +,5]; $day=sprintf"%02d",$day; $month=sprintf"%02d",$month+1; $year=sprintf"%04d",$year+1900; my $Date="$month/$day/$year"; my $RegDate=qr/$month\/$day\/$year/o; ## Setup and precompile the errorcodes ## my $err1=qr/Disconnected/o; my $err2=qr/sopup\.sh/o; my $err3=qr/switch_sh\.sh/o; my $err4=qr/Node/o; my $err5=qr/^NetBIOS/o; my $err6=qr/Manual/o; my $err7=qr/Beginning/o; my $err8=qr/^AUP rejecting duplicate transaction/o; my $err9=qr/LAN/o; my @Messages=qw($err1 $err2 $err3 $err4 $err5 $err6 $err7 $err8 $err9) +; $/="------------------------------------------------------------------ +---------- --\n"; my $File="Unity$Number.log"; my $RPT=substr($File,0,8); my $Filepath="/HOST/INDATA/stlog/$File"; my $Rptpath="/HOST/INDATA/stlog/$RPT"; open(FH,"$Filepath")||die"Can't open $File: $!\n"; my (%hash,$count); $count=1; while(<FH>){ chomp; my @array=split /\n/; foreach my $msg(@Messages){ if($array[0]=~/^Number/){}else{ if($array[6]=~$msg & $array[1]=~$RegDate){ my $ref=\@array; $hash{$count}=$ref; $count++; } } }## END OF FOREACH STATEMENT ## }## END OF WHILE STATEMENT ## close FH; open(RPT,">$Rptpath")||die"Can't open $RPT: $!\n"; print RPT "Report Date: $Date\n"; print RPT "$RPT\n"; print RPT "============================\n"; foreach my $key(keys %hash){ for(0..6){ print RPT "$hash{$key}[$_]\n"; } print RPT $/; } close RPT;

TStanley
--------
It is God's job to forgive Osama Bin Laden. It is our job to arrange the meeting -- General Norman Schwartzkopf

In reply to Re: Loading a HoH by TStanley
in thread Loading a HoH by TStanley

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.