Languages

Fsharp
ActionScript
xBase
Clean
GPSS
PureBasic
Sieve
Erlang
JOVIAL
Mercury
Linda
DataFlex
PostScript
FoxPro2
VFP
Cobol
Prolog
Jython
Awk
VisualBasic
JavaScript
Matlab
ASP
Haskell
Csharp
D
Smalltalk
Nemerle
Pixilang
Java
SQL
Python
ObjectPascal
Ruby
Perl
Pascal
Assembler
PHP
C
Functions  Add function  Users  Registration  Enter   About  ASCII Table  Our helpers

each in Perl

each HASH

When called in list context, returns a 2-element list consisting of the key and value for the next element of a hash, so that you can iterate over it. When called in scalar context, returns only the key for the next element in the hash.

Entries are returned in an apparently random order. The actual random order is subject to change in future versions of perl, but it is guaranteed to be in the same order as either the keys or values function would produce on the same (unmodified) hash. Since Perl 5.8.1 the ordering is different even between different runs of Perl for security reasons (see "Algorithmic Complexity Attacks" in perlsec).

When the hash is entirely read, a null array is returned in list context (which when assigned produces a false (0) value), and undef in scalar context. The next call to each after that will start iterating again. There is a single iterator for each hash, shared by all each, keys, and values function calls in the program; it can be reset by reading all the elements from the hash, or by evaluating keys HASH or values HASH. If you add or delete elements of a hash while you're iterating over it, you may get entries skipped or duplicated, so don't. Exception: It is always safe to delete the item most recently returned by each(), which means that the following code will work:
while (($key, $value) = each %hash) {
print $key, "\n";
delete $hash{$key}; # This is safe
}

The following prints out your environment like the printenv(1) program, only in a different order:
while (($key,$value) = each %ENV) {
print "$key=$value\n";
}

See also keys, values and sort.
Add by Pancho
You can edit it here
Adding comments is available only for registered users.

Birth of a Hurricane

Image of a hurricane over the Caribbean between Cuba and Central America.

Summer storms are a regular feature in the North Atlantic, and while most pose little threat to our shores, a choice few become devastating hurricanes.

To decipher which storms could bring danger, and which will not, atmospheric scientists are heading to the tropics to observe these systems as they form and dissipate--or develop into hurricanes.

By learning to identify which weather systems are the most critical to track, the efforts may ultimately allow for earlier hurricane ...

More at http://www.nsf.gov/news/news_summ.jsp?cntn_id=117388&WT.mc_id=USNSF_51&WT.mc_ev=click


This is an NSF News item.

PycckaR
BepcuR


Articles
Articles


Library
Library


Downloads
Downloads

Google Chrome Golf 6
 © Internet, books, teachers and Rudevich Alexander brains.