while (@$chain) { my $pair = shift @$chain;