Did some search but couldn't find anything useful.
I was wondering if there is a summary table of sort for beginners to learn about the "rules" of using parens/brackets, specifically, the differences among (), [], {}.
Unfortunately, in my experience, use strict
and use warnings
don't tell me if I use the wrong parens.
For example, below are the legit codes (b/c they came from ikegami).
@{"genotype".($i)}
@{$genotype[$i]}
$genotype[$i] = [ split (/:/, $original_line[$i])]
my @genotype = map {[split /:/]} @original_line[6..14]
But are these below also legit ? Often times it's hard enough (for me) to know if it's other parts (logic) of the codes that cause the problem. Sorting through parens to me (a beginner) seems trivial to good coding. Any guide on how to properly use parens will be great.
@{"genotype".[$i]}
@["genotype".($i)]
@("genotype".($i))
@{$genotype($i)}
@[$genotype($i)]
$genotypes[$i] = ( split (/:/, $original_line[$i]))
my @genotype = map ([split /:/]) @original_line[6..14]