Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: Doubt in Eval

by chrestomanci (Priest)
on Feb 17, 2012 at 21:26 UTC ( #954625=note: print w/replies, xml ) Need Help??


in reply to Re: Doubt in Eval
in thread Doubt in Eval

As a footnote, the reason that $a is exempt from strict checking, is because it is one of the magic variables that you can use to specify a custom comparison to sort

For example, suppose you have a list of hashes, and you want to sort by the value of a key, you might write:,

my @persons_by_age = sort { $a->{'age'} <=> $b->{'age'} } @people;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://954625]
help
Chatterbox?
[thepkd]: Anyways it works with $aohoaoh[0]->{'foo '}[0]->{'bar'}
[GotToBTru]: "I did it my $way"
[JohnCub]: I hope $way isn't a hashref. ;)
[GotToBTru]: many times i've been told I made a real hash of thiings
[GotToBTru]: so .. perhaps it should b e
[thepkd]: Just wondering why $aohoaoh[0]->{'foo '}[0]->{'bar'} would be difficult to read and understand?

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (12)
As of 2016-12-06 13:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (105 votes). Check out past polls.