while ( @list ) { $x = shift(@list); ($a,$b) = @$x; if ( ref($a) eq "CODE" ) { &$a($b); # modifies @list } else { $a->$b; # $a may be a class or an object; # modifies @list } } # end of evil code that tells me nothing