On Sat, Dec 14, 2002 at 12:51:50PM -0500, [EMAIL PROTECTED] wrote:
> Can somebody tell what is wrong with this.
> 
> I tried single quote (') in place of double quote(") neither of them work.
> 
> 184 for ($i = 0; $i < @clm_types; $i++)
> 185 {
> 186    @temp_str = grep (/$_/,@env_desc);
> 187    @fields = split (/,/,$temp_str[@temp_str - 1],4);
> 188    $env_final[$i] = join (/","/,$fields[1],$fields[2],@temp_str - 1);
> 189  }
> 
> /","/ should probably be written as "","" at loadstats1.pl line 188.


Unlike split, join() takes a string as its first argument, not a regex.  What you want 
is this:

        $env_final[$i] = join (",",$fields[1],$fields[2],@temp_str - 1);
                              ^^^^ 
                                |
                              Notice--no '/'s here

However, I'm not really sure that that's what you want either.  As
written, this line will join three elements into a string and assign
it to $env_findal[$i].  The three elements it will join are:

        $fields[1]
        $fields[2]
        @temp_str - 1

The problem is that last one...I suspect that you want it to be the
last element of @temp_str, but what it is actually going to be is
the number that you get by subtracting 1 from the number of elements
in @temp_str.  Try this instead:

   $env_final[$i] = join(",",$fields[1],$fields[2],$temp_str[-1]);

--Dks

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

Reply via email to