Melissa Cama wrote:
> 
> Hi,

Hello,

> I currently have a hash which has one value as the key, and then
> an array of values assigned to this key.  However the arrays are
> different lengths.
> 
> I need to print out each value in the array (for each key) as a
> new line in an excel/CSV file.  Also with each new line, a time
> stamp needs to be printed.
> 
> For example this is the format i need. - I dont need the keys(features)
> to be printed out just the values in the array assigned to this key.
> 
>                 Feature1                Feature2
> timestamp       value 1 of array1       value 1 of array2
> timestamp       value 2 of array1       value 2 of array2
> timestamp                               value 3 of array2
> 
> This is my code just for the printing:
> 
> foreach $str_feature (%hash_FeatureUsers){
>     foreach my $val (@{$hash_FeatureUsers{$str_feature}}) {
>         print (userfile $STR_CVSSTRINGBRACKET.&GetTimeStamp().$STR_CVSSTRINGBRACKET);
>         print (userfile $STR_CVSCOMMA."$val\n");
>         }
>     }
> 
> At the moment this is only printing the values of one array, and
> it does it three times.
> 
> Any help would be appreciated.  I know its quite difficult to
> understand, my explanation isn't very good.


Something like this should work:

for my $str_feature ( keys %hash_FeatureUsers ) {
    print userfile $STR_CVSSTRINGBRACKET .
                   GetTimeStamp() .
                   $STR_CVSSTRINGBRACKET .
                   $STR_CVSCOMMA .
                   join( $STR_CVSCOMMA,
@{$hash_FeatureUsers{$str_feature}} ) .
                   "\n";
    }



John
-- 
use Perl;
program
fulfillment

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

Reply via email to