use strict;
use warnings;
#this scripts we define the second variable: ARRAY, @. It's simple: a group of scalars

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

my @id=($id1, $id2);
#define array @id. 
my @seq=qw(ATAATROFHJKDGHJFKFGDHJK ATAATROFHJKDGHJFKFGDHJKPLUS); 
#qw means quote word: it gets the words (scalars) and make them scalars in an array



#now we get scalars out of an array
foreach my $str (@id)
{
#foreach takes one scalar out everytime without changing the array; you need to name the SCALAR extracted by a new name " my $str" in order to work with it. 
print $str, "\n"; 
}

#shift is differnt, it takes first scalar out and delete it from array
my $id3=shift (@id);

print $id3, "\n";
print @id, "\n";  

#pop is opposite: it takes last scalar out and delete it from array

my $id4=pop (@seq);
print $id4, "\n";
print @seq, "\n";  


#you can also take scalar based on position: in array the coding starts from 0, then 1, 2....and the each time you specify a position it becomes a scalar--so use $
print $id[0], "\n";
print $seq[1], "\n"; 


#join connects all elements using a symbol you define and it becomes a scalar
print join (",", @seq), "\n";

#push something in an array: here scalars from @seq goes to @id; 
push @id, @seq; 

print join (",", @id), "\n"

#PS, try those lines:
my $n=@id;
print $n, "\n";
#or simply 
print @id."\n"; 
#see? it gives the size of array. 
