I am also a long-time lurker / First time responder, so hopefully I'll answer acceptably per the email-list conventions... I will assume that some of the basic references are available to you (or that others will cite them correctly... as they appear to be doing; many responses so far.) Anyway, *syntax* is relatively easy to answer; *why* someone might have written such a thing, not always as much...
I would personally interpret this question in the way I would normally see it: "Why is someone putting parentheses around these variables?" When confronted with questions like this (and I often encounter obscure Perl in my daily work, so that's fairly common here) I start by directing the questioner to two things: google site:perlmonks.org parentheses variable google site:stackoverflow.com parentheses variable My justification for this is, when trying to figure out why one piece of code is a certain way, it helps to go to the sites where people who write code share what they're doing, and other people comment knowledgeably about it. (I'm sure there are other sites that others recommend; these are just the two I've found most useful.) Scanning through the results, I might use them to answer someone who asked the question the way I wrote it... more-or-less this way: Left-hand-side: Putting parentheses around a scalar (or a set of scalars) is a way to assign values to everything in the list all at the same time (even if it's just have one thing getting one assignment). Right-hand-side: Putting parentheses around an array is shorthand for getting the first element of the array (by converting the elements into a list -- changing from scalar to list context) ...in the same way that leaving the parentheses off and not specifying a single element, will return the number of elements in the array. Further, it's worth noting that putting parentheses around a single scalar on the left-hand-side of an assignment (a list of one thing)... is subtle. For example, in http://stackoverflow.com/questions/10031455/perl-using-my-with-parentheses-and-only-one-variable I see that http://stackoverflow.com/users/2766176/brian-d-foy (who answers these types of questions for a living) is essentially saying on one hand that he does it just because he's used to typing "my (" and some stuff, and then ");" and that just having one thing isn't a problem; but he also notes farther down http://perldoc.perl.org/perlfaq4.html#What-is-the-difference-between-a-list-and-an-array%3f for completeness. Hope this helps! -Steve Kaftanski, MadMongers.org (Madison.pm Wisconsin). On Thu, May 29, 2014 at 3:20 PM, James Kerwin <jkerwin2...@gmail.com> wrote: > Hello all, long time lurker, first time requester... > > I have a Perl exam tomorrow and came across a question that I just cannot > find an answer to (past paper, this isn't cheating or homework etc.). > > Explain the difference between: > > ($test)=(@test); > > And > > $test=@test; > > If anybody could shed any light on this I'd be very grateful. > > Thanks, > James. >