Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^4: hash array

by Anonymous Monk
on Oct 09, 2012 at 11:54 UTC ( #997992=note: print w/replies, xml ) Need Help??


in reply to Re^3: hash array
in thread hash array

thanks my issue got solved .... can u please explain about "map"

Replies are listed 'Best First'.
Re^5: hash array
by bart (Canon) on Oct 09, 2012 at 18:25 UTC
    map is a looping function to apply an expression or a block to every item in a list (each item in turn assigned to $_), and collect/return the list of results. It's like:
    my @results; foreach(@_) { push @results, &$CODE(); } return @results;
    where $CODE is the expression (delimited by a comma) or block (no delimiter) in the first argument.

    example:

    @output = map $_*2, 1 .. 10;
    which is identical in result to
    @output = map { $_*2 } 1 .. 10;
    and which return the even numbers from 2 to 20; the double of all numbers between 1 and 10.
Re^5: hash array
by McA (Priest) on Oct 09, 2012 at 11:58 UTC

    Please have a look at perldoc -f map. If there's something you don't understand, allmost everyone will help you.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://997992]
help
Chatterbox?
[marto]: fortunately my bad jokes and puns don't fall into those categories :P
[Corion]: :-D
Corion discovers a new shiny toy to try out over the (longish) weekend. Since I've done some more with websockets, maybe I'll try writing a webserver that implements hot-reloading of HTML(+CSS, +Javascript) in the browser. Edit the local file and ...
[Corion]: ... the browser(s) get a ping to a) refresh the page or b) reload "just" the changed parts, keeping the scroll position etc.
[Corion]: But I also have to look at how I can make WWW::Mechanize:: RemoteBrowser a reality, and how to make it safe from malicious content ;)

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (8)
As of 2018-04-26 10:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?