Discuss Scratch

trinary
Scratcher
96 posts

Perl...

Does anyone know Perl?
This works, but I'm uncertain why:

my @matrix=();
while (my $ary = $st->fetchrow_hashref())
{
push(@matrix,{%$ary});
}

What precisely is occurring when I push %$ary to the matrix array?
I'm not quite sure if it's referencing the hash %ary and placing it as an anonymous variable in @matrix, or doing something else.

trinary
Scratcher
96 posts

Perl...

I'm aware that this may be a better fit on StackOverflow, but I'd really like to know if someone here knows.
cocolover76
Scratcher
100+ posts

Perl...

This would go in Advanced Topics.
mythbusteranimator
Scratcher
1000+ posts

Perl...

cocolover76 wrote:

This would go in Advanced Topics.
But these aren't advanced scratch topics
Gravitation
Scratcher
100+ posts

Perl...

Woah, Perl, eh? 90s club?

trinary wrote:

it's referencing the hash %ary and placing it as an anonymous variable in @matrix
That's correct, actually.
macadam
Scratcher
500+ posts

Perl...

My dad can program in Perl
trinary
Scratcher
96 posts

Perl...

Gravitation wrote:

Woah, Perl, eh? 90s club?

trinary wrote:

it's referencing the hash %ary and placing it as an anonymous variable in @matrix
That's correct, actually.
Thank you very much :D
I'm attempting to learn Lisp too…

Powered by DjangoBB