Yes, [] acts on the result (a positional, e.g. a list) returned by function
or method, it does not act on the function or method itself.

You have more or less the same in Perl 5, for example:

my $first_item = (split /;/, $string)[0];

Here, the [0] acts on the list returned by split.


Le mar. 2 oct. 2018 à 08:05, ToddAndMargo <toddandma...@zoho.com> a écrit :

> On 10/1/18 3:37 PM, Donald Hunter wrote:
> > toddandma...@zoho.com (ToddAndMargo) writes:
> >>
> >> Hi Curt,
> >>
> >> Perfect! Thank you!
> >>
> >> So all methods that respond with --> Positional will accept []
> >>
> >> Awesome!
> >>
> >> -T
> >
> > Not quite.
> >
> > All methods that respond with --> Positional, provide a Positional that
> > will accept []
> >
> > Methods don't accept [], values that are positional do that.
> >
> > Cheers,
> > Donald.
> >
>
> Hi Donald,
>
> I am confused.  I though we both said the same thing?
> Is your distinction that [] is actually a routine in itself
> and not part of the method?  And I am lumping them together?
>
> -T
>

Reply via email to