sub devices_for { my ( $thing ) = @_; return $thing if $thing =~ /^DEVICE\d/; return map { devices_for( $_ ) } query( $thing ); }