User Tools

Site Tools


referance_subroutines

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
referance_subroutines [2012/02/07 18:58]
k2patel created
referance_subroutines [2020/08/10 02:35] (current)
Line 8: Line 8:
  
 The following table discusses the referencing and de-referencing of variables. Note that in the case of lists and hashes, you reference and dereference the list or hash as a whole, not individual elements (at least not for the purposes of this discussion). The following table discusses the referencing and de-referencing of variables. Note that in the case of lists and hashes, you reference and dereference the list or hash as a whole, not individual elements (at least not for the purposes of this discussion).
 +
 +^ Variable ^ Instantiating the scalar ^ Instantiating a reference to it ^ Referencing it ^ Dereferencing it ^ Accessing an element ^
 +| $scalar | $scalar = "​steve";​ | $ref = \"​steve";​ | $ref = \$scalar | $$ref or ${$ref} | N/A |
 +| @list | @list = ("​steve",​ "​fred"​);​ | $ref = ["​steve",​ "​fred"​];​ | $ref = \@list | @{$ref} | ${$ref}[3] $ref->​[3] |
 +| %hash | %hash = ("​name"​ => "​steve",​ "​job"​ => "​Troubleshooter"​);​ | $hash = {"​name"​ => "​steve", ​ "​job"​ => "​Troubleshooter"​};​ | $ref = \%hash | %{$ref} | ${$ref}{"​president"​} $ref->​{"​president"​} |
 +| FILE | | | $ref = \*FILE | {$ref} or scalar <​$ref>​ | |
 +
      
  
-|Variable|Instantiating 
-the scalar|Instantiating a 
-reference to it|Referencing it|Dereferencing it|Accessing an element| 
-|$scalar|$scalar = "​steve";​|$ref = \"​steve";​|$ref = \$scalar|$$ref or 
-${$ref}|N/​A| 
-|@list|@list = ("​steve",​ "​fred"​);​|$ref = ["​steve",​ "​fred"​];​|$ref = \@list|@{$ref}|${$ref}[3] 
-$ref->​[3]| 
-|%hash|%hash = ("​name"​ => "​steve",​ 
-   "​job"​ => "​Troubleshooter"​);​|$hash = {"​name"​ => "​steve",​ 
-   "​job"​ => "​Troubleshooter"​};​|$ref = \%hash|%{$ref}|${$ref}{"​president"​} 
-$ref->​{"​president"​}| 
-|FILE|||$ref = \*FILE|{$ref} or scalar <​$ref>​|| 
  
 These principles are demonstrated in the source code below. Note the following anomolies: These principles are demonstrated in the source code below. Note the following anomolies:
referance_subroutines.1328641106.txt.gz · Last modified: 2020/08/10 02:29 (external edit)