For seperating your array elements with a comma, use the join command.

push ( @ar2 ,"123\t" ,join("," ,@ar1 ));

If @ar1 is a list of letter groups, the following line will push into @ar2
the number + TAB followed by however many letter groups seperated by a
comma.

printing @ar2 results in:

123     abc,def,ghi,lmn









-----Original Message-----
From: AITHA, BHEEMSEN (SBCSI) [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 18, 2002 7:58 PM
To: 'Arnold, Craig'; '[EMAIL PROTECTED]'
Subject: [Perl-unix-users] Help on Array


Hi list,

I would like to create an array in the following format:


123     abc,xyz,pqr
234     xyz
456     wer,tre
---
---

I want to use a command like the following

push @first_array, <the_number> <tab> <group of words separated by commas
from second_array>;

where the_number = values in 1st column coming from a variable in a loop.
The values in second column are a list of complete elements from
second_array. abc, xyz, pqr etc.. are individual elements in second_array. I
also don't know how to insert commas in between the individual elements (
i.e. a comma between abc and xyz and so on while creating the array). Every
time after writing a row I will be deleting all the elements in second_array
with $#second_array = -1. The loop will push new values into second_array
before writing a new row into the first_array.

Thanx..
-Bheem
_______________________________________________
Perl-Unix-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
Perl-Unix-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to