develooper Front page | perl.beginners | Postings from December 2002

I guess I am not doing it right???

Thread Next
From:
Satya_Devarakonda
Date:
December 23, 2002 10:16
Subject:
I guess I am not doing it right???
Message ID:
OFF7074D34.49659BB1-ON85256C98.005D1FFD@tufts-health.com
Hi,

I have a set of strings in array @search_key and a log file loaded into an
array @modem_log.

I want to extract lines that contain the keys and load them into four
arrays - @env_start, @env_end, @env_files, @env_bytes, @env_errors.

Can somebody tell me if what I am doing below is right?

Thanks for your help...
Satya::Novice_City

----------------------------------------------------------------------------------------------------------------
my @search_key = qw (FILETYPE.ZIP RBZ RBZ Bytes Errors);
my @search_out =  qw( \@env_start  \@env_end  \@env_files  \@env_bytes
\@env_errors );

    for ($i = 0, $j = 0; $i < @search_key; $i++)
    {
        ${search_out[$i]} = grep (/$search_key[$i]/,@modem_log);
        for ($j = 0; $j < ${search_out[0]}; $j++)
        {
           ${search_out[$i]} = substr ($search_out[$i][$j],$str_start
[$j].$str_length[$j]);
        }
    }
----------------------------------------------------------------------------------------------------------------






Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About