on 5/13/02 3:08 AM, [EMAIL PROTECTED] purportedly said: > But I need something a little bit different.For each number I want to write > the ct, the ma, the mb.And the output wuold be: > > ct000043 > ct000056 > ma000043 > ma000056 > mb000043 > mb000056 > > I hope to became soon to be able to do this without help but now... > Many thanks another time.Bye
That is actually easier. Simply reverse the key and value. In this case you need only a simple hash data structure. Of course, this would suppress duplicates: while( <DATA> ) { chomp; if( /(00\d+)/ ) { $value = $1; next if !/^(ct|ma|mb)/; } else { $value = $_; } $hash{$_} = $value; } foreach ( sort keys %hash ) { print OUT ( $hash{$_} => $_ ), "\n"; } Keary Suska Esoteritech, Inc. "Leveraging Open Source for a better Internet"