sub devices_for { my ( $thing ) = @_; my @subs = query( $thing ); return map { /^DEVICE\d+/ ? $_ : devices_for( $_ ) } @subs; } #### sub devices_for { my ( $thing ) = @_; return $thing if $thing =~ /^DEVICE\d/; return map { devices_for( $_ ) } query( $thing ); } #### sub devices_for { return ( $_[0] =~ /^DEVICE\d/ ) ? $_[0] : map { devices_for( $_ ) } query( $_[0] ); }