in reply to Re: Building a dynamic array or some other method?
in thread Building a dynamic array or some other method?

You're right that there are some differences after the unique names. I think the most likely part to change is also the more descriptive name of the user mentioned earlier, and can be dismissed. The types of data found, and the hit counts stay the same for each file, and are important to keep.

I have a question about notation or elements found within this line, which I'm unfamiliar with.
I'm unsure what they'd be called to even look them up
my @headers = $csv->getline( *DATA )->@*;

What is this called? *DATA? In C (ancient class I took) it looks like a pointer, but what is DATA? It's not defined previously.

And what does ->@* do after that, as I see the assignment going left into @headers? Is that an array wildcard?

Replies are listed 'Best First'.
Re^3: Building a dynamic array or some other method?
by choroba (Cardinal) on Apr 23, 2024 at 21:09 UTC
    *DATA is a file handle, pointing to the part of the source file after the __DATA__ mark.

    The ->@* is a post-dereference, it's an alternative way of writing

    my @headers = @{ $csv->getline( *DATA ) };

    The getline method returns an array reference, by dereferencing it we get an array which we (shallow) copy into @headers.

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
      I'm coming back to this pretty late.

      I wanted to say thank you for explaining those items. I'll look further into the __DATA__ mark thing. I didn't understand that, but at least there's enough unique characters to search for it within the perl documentation.