in reply to (jeffa) Re: Using list elements within lists contexts with the distributive properties of HTML shortcuts
in thread Using list elements within lists contexts with the distributive properties of HTML shortcuts

Thanks. Works perfectly. Any chance I could prevail upon you to explain the use of map instead of passing the ref (\@list) to a()?

Is it because passing the list ref means that the enumeration of the elements is done out of my scope?

I can see where I was going wrong with the [], I was using them inside the ()'s instead of as a replacement for them. (back to perlref to try and understand why I should do this, but its always easier to understand working code than see whats wrong with non-working).

Regards.

  • Comment on Re: (jeffa) Re: Using list elements within lists contexts with the distributive properties of HTML shortcuts

Replies are listed 'Best First'.
(jeffa) 3Re: Using list elements within lists contexts with the distributive properties of HTML shortcuts
by jeffa (Bishop) on Jun 09, 2002 at 21:21 UTC
    Sure, i will discuss the a() shortcut and let you apply it to the others.

    Each shortcut takes an optional reference to a list and distrubutes it across each element. That you know, but when you try to do this via:

    a( {-href=>$_ }, \@list )
    the default variable is not 'associated' with the list reference. Indeed, the enumeration of the elements is done outside of your scope.

    The only way (that i know of) to 'associate' it is to use a loop instead:

    for (@list) { print a({-href=>$_},$_); } # or print a({-href=>$_},$_) for @list; # or print map {a({-href=>$_},$_) } @list;

    jeffa

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    B--B--B--B--B--B--B--B--
    H---H---H---H---H---H---
    (the triplet paradiddle with high-hat)
    

      Thanks again. The murk is thinning slowly, just rather more slowly than I would care to admit.