in reply to Re: What does [=;] mean
in thread What does [=;] mean
First off, I cringe every time I see PERL. So don't do that. Most often you mean 'Perl', the language (as opposed to 'perl' the interpreter).
In Perl a % at the front of something means the thing returns a hash. A hash is kinda like an array except that it contains key => value pairs. The split built the hash contents by generating an array of paired entries.
The for loop iterates over the keys for the hash %spl. Note that the keys are 'PROGEEK', 'GEEKS' and 'GFG'. The values happen to be numbers - they could be strings or other things.
Perl has a really nifty feature called 'interpolation' which replaces variables in a string with the content of the variable. The print uses interpolation in its string to print the key (in $i) followed by a colon (just boring text - no magic here) then the value in the %spl hash associated with the key in $i (that's the $spl{$i} bit).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: What does [=;] mean
by Scotmonk (Sexton) on Nov 27, 2019 at 23:50 UTC |