in reply to matching &printing S variable of an array
The thing is, if you want the last element of an array, you need to do: $peptide = $peptides[$#peptides]chomp(); # remove the newline from $_; $peptide = $_; # Current peptide (line) being checked push(@peptides, $peptide); # Adds each peptide to an array (note the s +ingular/plural)
Alternatively, you can write both assignments in a single line:
push(@peptides, $peptide = $_);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: matching &printing S variable of an array
by Bijgom (Initiate) on Feb 24, 2015 at 08:49 UTC |