use strict;
use warnings;
#let's start the last kind of variable--not a real one but super useful--reference
#like pointer in C, it gives only an address in memeory, but it is treated like a scalar. array and hash in Perl actually only takes scalar as basic elements so you can't make arrays of hashes or hashes of arrays and so on...
#complex structures and objects must be done in references. 



my $id1="whatever_id1";
my $seq1="ATAATROFHJKDGHJFKFGDHJK";
my $id2=$id1; 
my $seq2="ATAATROFHJKDGHJFKFGDHJKPLUS"; 


my @id=($id1, $id2);
my @seq=($seq1, $seq2); 
my @temp=(@id, @seq); 


#how it's referenced: by "\"
my $ref1=\@id;
my $ref2=\@seq;  
#see what kind of variable it is now by "ref"
print $ref1, " ", ref($ref1); 



#so we write a subroutine that takes 2 arrays

cypion1(@id, @seq);

sub cypion1
{
my (@a1, @a2)=@_;

print "first array is ", @a1, "\n";
print "second array is ", @a2, "\n";
#see the problem? when you put 2 arrays into subroutine it can't tell which one is first and which is second-- all becomes first array and second is empty
}


#now a subroutine that takes references 
cypion2($ref1, $ref2); 
sub cypion2
{
my ($a1, $a2)=@_;

print "first array is ", @{a1}, "\n";
print "second array is ", @{a2}, "\n";
#dereferencing is simply done by adding the correct symbol in front of the ref and it will return the values
}


#now you can make arrays of references to hashes/arrays or hashes that points to hashes/arrays--reading out of the values would also be different, please check when you really need to make this kind of data


