Dear Jose,
thanks a lot for your solution. Also after burning my head I found my
own solution (shown below). However I if use the switch -w I got a
message saying "Use of uninitialized value at ..", I do not why.
cheers,
Pedro
#!/bin/perl -w
use strict;
my (@array, @array2, %hash, $i, $j, $key);
while (<>){
chomp;
@array = split(/\s+/,$_,2);
push @array2, $array[0];
$hash{$array[0]} = $array[1];
}
$j = 0;
for ($i = 0; $i <= $#array2; $i++){
if ( $hash{$array2[$i]} eq $hash{$array2[$i+1]} ) {
$j++;
}
else {
print "$hash{$array2[$i]} from $array2[$i-$j] to $array2[$i]\n";
$j=0;
}
}
####################
*******************************************************************
PEDRO A. RECHE , pHD TL: 617 632 3824
Dana-Farber Cancer Institute, FX: 617 632 4569
Harvard Medical School, EM: [EMAIL PROTECTED]
44 Binney Street, D1510A, EM: [EMAIL PROTECTED]
Boston, MA 02115 URL: http://www.reche.org
*******************************************************************
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]