in reply to Re^2: What's this line means in HTTP::headers?
in thread What's this line means in HTTP::headers?
"My another question is about the reason of using the ++. If the 0(false) is added to 1, what's the incrementing for? It's not like an iterator's or a pointer's moving we normally see. The increasing didn't change anything seemingly."
I don't understand what point you're making here. Take a look at these two scripts: the first with ++, the second without.
$ perl -Mstrict -Mwarnings -le ' my @fields = qw{a a b c b a}; my %seen; for my $field (@fields) { print $field, $seen{$field}++ ? "PUSH" : "SET"; } ' aSET aPUSH bSET cSET bPUSH aPUSH
$ perl -Mstrict -Mwarnings -le ' my @fields = qw{a a b c b a}; my %seen; for my $field (@fields) { print $field, $seen{$field} ? "PUSH" : "SET"; } ' aSET aSET bSET cSET bSET aSET
That may clarify whatever is causing confusion or misunderstanding. If not, please supply a similarly short piece of code to explain your point.
"... I decided to find some artical about Perl Ops priority to read first."
Take a look at "perlop - Perl operators and precedence". There's a table of precedence and associativity at the start of the documentation. While you're there, you might as well also look at these sections further down the page: "Auto-increment and Auto-decrement" for "++" and Conditional Operator for "?:".
-- Ken
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: What's this line means in HTTP::headers?
by anaconda_wly (Scribe) on Sep 06, 2013 at 03:33 UTC |