Lance Prais wrote:
> 
> #open a file with the filehandle
> open WORKFLOW, "..\\..\\workflow.txt"  or die "Cannot open Workflow $!\n";
> my $data = <WORKFLOW> for (1..21);
> while     # loop through the workflow.txt
> 
>  chomp;   #a)
>  my $line=$_;
>  print STDERR "\nline: $line";
> }
> 
> The above code is reading a txt file beginning at line 20.  I want to input
> each line into an array and the parse through in and compare values in 22 to
> find if a condition exists.
> 
> The issue is I need to break the line up into evenly divided line segments
> can any one recommond the best way to do this?
> 
> I was thinking use hash tables.. also do you know where there is an exaplin
> that would help me begin?

There are good books at oreilly (http://perl.oreilly.com/). Start with
learning perl and/or perl cookbook. If you prefer online info, look at
www.perl.org and www.perldoc.com


> 
> Here is the lines that need to be parsed and compared:
> 
> SV_NAME      CC_ALIAS  TK_TASKID  TK_PID  TK_DISP_RUNSTATE   CC_RUNMODE
> TK_START_TIME        TK_END_TIME          TK_STATUS
> CG_ALIAS
> -----------  --------  ---------  ------  -----------------  ----------  ---
> ----------------  -------------------  -------------------------------------
> ----  --------
> CHK_SBL_DEV  WorkMon   63526              Exited with error  Background
> 12/12/2001 14:58:26  12/12/2001 14:58:32  ESC-00053: Error loading rule
> definitions  Workflow
> 
it's har do tell how to parse this line (lines?) as the mailreader cuts
long lines but it seems like you have one line with names(keys)
separated with tabs, one that provides no info and one with values
connected to the names.

if you split the line with keys
my @keys = split (/\t/, $key_row); # i assume it's tabs
<WORKFLOW>; #throw line with junk
my @values = split (/\t/, <WORKFLOW>); # again tabs?
my %hash;
for (my $i = 0; $i <= $#keys;$i++)
{
   $hash{$keys[$i]} = $values[$i];
}
print STDERR "$_ -> $hash{$_}\n" foreach (sort keys %hash); # print them


/Jon
 


> Thank you
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to