Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^3: How would I write this using map?

by monarch (Priest)
on Jan 13, 2009 at 23:56 UTC ( #736111=note: print w/ replies, xml ) Need Help??


in reply to Re^2: How would I write this using map?
in thread How would I write this using map?

I can't see how this would work. I tried to create some mock code:

use strict; { package MyObj; sub new { my %obj; bless( \%obj, $_[0] ); return( \%obj ); } sub items { my @things = ( 'key1' => 'v1', key2' => 'v2', ); return( @things ); } } my $myobj = MyObj->new(); print( "$_\n" ) foreach ( sort keys( $myobj->items() ) );
but kept getting this error:
Type of arg 1 to keys must be hash (not subroutine entry) at /tmp/deleteme.pl line 25, near ") ) "


Comment on Re^3: How would I write this using map?
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://736111]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (4)
As of 2014-07-12 22:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (241 votes), past polls