OK, so two questions on odd syntax. I am working on some older Perl code that needs modification, and I came across the following line:
@$tmp=split(/,/,$tmpVals);
I have no idea how to read this, it looks like the RHS is splitting the variable string on , so that's fine, but it is the left hand side I am thrown by. What in the world is @$
, as far as a I know it isn't a default variable. DOes anyone know its significance?
And then there is $$
, which I have read normally represent the Perl PID. How开发者_C百科ever, in this case it comes right before a veriable/assignment statement. Does it have a related effect there?
$$tmp=$row[1];
Thanks in advance.
What you're looking at are not special perl variables, but instances of references. They're described in perlref.
These are symbolic references: If $tmp
contains "myvar", then the variable @myvar
will be assigned to. The same applies to the second example.
精彩评论