PerlNewUser
Technical User
After reading this very helpful forum for a few weeks, and now I finally have a question!
I am learning Perl and don’t fully understand hashes. I understand that they can be used in place of arrays to simultaneously compare and change data, but which part of the hash expression does what? For example:
I don’t follow how values are assigned. Also, can more than one data element be compared if I want the value of $MyData to depend on the existence of Two or More elements within the hash, i.e.
$DesiredValue=(exists $hash{$Mydata1} && exists $hash{MyData2})
I am learning Perl and don’t fully understand hashes. I understand that they can be used in place of arrays to simultaneously compare and change data, but which part of the hash expression does what? For example:
Code:
%Hash(Value1, value2, value3)
$MyData = (exists $hash{$MyData}) ? $Hash{$MyData} : ‘Or Else Print This’;
I don’t follow how values are assigned. Also, can more than one data element be compared if I want the value of $MyData to depend on the existence of Two or More elements within the hash, i.e.
$DesiredValue=(exists $hash{$Mydata1} && exists $hash{MyData2})