Re: how to append blocks in same file

2005-06-24 Thread Aditi Gupta
hello everybody, first of all i'd like to thank all of you for your time and help.. but i'm still stuck!! The code which Dave sent: my @blocks = (); my $maxlen = 0; while (DATA) { chomp; if (/^#/) { push @blocks, []; } elsif ($_) { push @{$blocks[$#blocks]}, $_; my $len =

Re: how to append blocks in same file

2005-06-24 Thread John W. Krahn
Aditi Gupta wrote: On 6/23/05, John W. Krahn [EMAIL PROTECTED] wrote: Aditi Gupta wrote: I have a file as follows: #block1 aaa aaa #block2 bbb bbb #block3 ccc ccc and i want to append(or i should say merge) these blocks and get a file like this: aaabbbccc aaabbbccc how can this be

Re: how to append blocks in same file

2005-06-23 Thread John W. Krahn
Aditi Gupta wrote: Hi Perlers, Hello, I have a file as follows: #block1 aaa aaa #block2 bbb bbb #block3 ccc ccc and i want to append(or i should say merge) these blocks and get a file like this: aaabbbccc aaabbbccc how can this be done using perl? please help.. $ echo aaa aaa

how to append blocks in same file

2005-06-22 Thread Aditi Gupta
Hi Perlers, I have a file as follows: #block1 aaa aaa #block2 bbb bbb #block3 ccc ccc and i want to append(or i should say merge) these blocks and get a file like this: aaabbbccc aaabbbccc how can this be done using perl? please help.. regards Aditi

RE: how to append blocks in same file

2005-06-22 Thread Larsen, Errin M HMMA/IT
Aditi Gupta wrote: Hi Perlers, I have a file as follows: #block1 aaa aaa #block2 bbb bbb #block3 ccc ccc and i want to append(or i should say merge) these blocks and get a file like this: aaabbbccc aaabbbccc how can this be done using perl? please help.. regards

Re: how to append blocks in same file

2005-06-22 Thread Aditi Gupta
Hi all, I know the terms of the list.. and before this i have always written a code and asked for a doubt if it doesn't work... but this time i'm not aware of any way to do the job.. thats why i asked to help me out, I haven't asked for any code, just hints what can be used. I'm sorry if i

Re: how to append blocks in same file

2005-06-22 Thread Aditi Gupta
HI Dan, Since i'm using activestate perl on windows xp i don't know whether paste will work or not. I'll try the hash of array. Thanks for the help regards Aditi. On 6/22/05, Dan Klose [EMAIL PROTECTED] wrote: If I was doing this I would split the file on the gaps between blocks and the

Re: how to append blocks in same file

2005-06-22 Thread Dave Gray
On 6/22/05, Aditi Gupta [EMAIL PROTECTED] wrote: Since i'm using activestate perl on windows xp i don't know whether paste will work or not. I'll try the hash of array. Using a hash of arrays will not necessarily preserve the order. Below is the start of an array of arrays solution. I'll leave

Re: how to append blocks in same file

2005-06-22 Thread Dan Klose
Using a hash of arrays will not necessarily preserve the order... If you don't want to worry about sorting the order of the blocks i.e. doing it yourself then use Tie::IXhash (something like that on CPAN) to preserve the order, you then don't have to worry about unbalanced blocks and reassembly

Re: how to append blocks in same file

2005-06-22 Thread Dave Gray
On 6/22/05, Dan Klose [EMAIL PROTECTED] wrote: Using a hash of arrays will not necessarily preserve the order... If you don't want to worry about sorting the order of the blocks i.e. doing it yourself then use Tie::IXhash (something like that on CPAN) to preserve the order, you then don't

Re: how to append blocks in same file

2005-06-22 Thread Wijaya Edward
and i want to append(or i should say merge) these blocks and get a file like this: aaabbbccc aaabbbccc I've asked the same question some time ago, check this out: