Recently there was a post on array refs that had a follow-up stating you could force a list into array context using @{[ &make_list_here ]}. This isn't what i'm doing. But it relates...
A general warning, yes, i could use Parse::RecDescent, but i'm still trying to do some things the hard way to learn why other things work the way they do.
So i'm parsing a file and most of the data is flat, but there
are sometimes when i want to get a hash out of the data. So
the code i use is:
# this is in a loop that iterates through the file # and at some point it runs across: /(\S+)\s?=?\s?\[(.+)\]$/ && do { $hash{$1} = split /,/, $2; next; };
Looking this up it says i was assigning to @_, but it doesn't look like that at all to me. That looks like assingment to a hash entry as an anonymous list. When i apply the context generating code above like so:Use of implicit split to @_ is deprecated
the error message goes away. i'm glad the message is gone, but i'm wondering why it gave that error message (which seems inappropriate) and why this fixed it./(\S+)\s?=?\s?\[(.+)\]$/ && do { $hash{$1} = @{[ split /,/, $2 ]}; next; };
please enlighten this quandering quaffer of quintessential qualms (or not ; )
jynx
In reply to list vs array context: odd error message... by jynx
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |