Tuesday, May 7, 2013

a=b, b=a

We have some piece of legacy Perl code:
my $args = My::Args->get();
my $length = $args->{length};
foreach my $element( @list ) {
    action1( $element );
    try { action2( $element ); $args->{length} = $length; };
    action3( $element );
}
It's extremely ugly and also has one logical mistake. Try to find that mistake and guess why such a code ever existed.

No comments:

Post a Comment