On Mon, Jun 23, 2003 at 01:39:49PM -0700, Madhu Reddy wrote:

A little unasked-for code review :-)

> my %alpha_hash = ();
> open(FH_D,"$d_list") || die "File opening $d_list\n";
            ^       ^

You don't need to quote the variable.

> @file_list = <FH_D>;
> foreach $record (@file_list) {

And in this case it's not necessary to read the file into
a temporary array:

  while (<FH_D>) {

>       @t_array = split(/\|/, $record);
>       $alpha_hash{$t_array[0]} = $t_array[1];

If you only need two fields, it's more efficient to assign
split() to a list.

        my ($key, $value) = split /\|/;
        $alpha_hash{$key} = $value;

The split() operator is clever/lazy enough to notice that you 
only need the first two chunks, and it does the least amount 
of work necessary to provide them.

(Roughly speaking, it does "split /\|/, $_, 3".)

-- 
Steve

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

Reply via email to