Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re^2: error message in the end of the array looping?

by dank (Initiate)
on Jun 01, 2006 at 07:02 UTC ( #552985=note: print w/replies, xml ) Need Help??

in reply to Re: error message in the end of the array looping?
in thread error message in the end of the array looping?

Alternatively, if you can get your hands on it, List::MoreUtils has a bunch of small, but useful subroutines.

use List::MoreUtils qw(any); ... print "Success" if any { $_ eq "correct_value" } @hash{@array};

1 - note the use of a hash slice; it takes some getting used to, having a @ instead of a % in front.
2 - please use something more meaningful than %hash or @array as var names in your actual code :)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://552985]
[1nickt]: think that might be a winner, stevieb
[1nickt]: My wife is doing a uni degree on line and using a 17" laptop with 1600 x 900 res. But she won;t let me upgrade her screen unless she still gets 17", full keybd, and dvd writer!

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2017-03-26 18:28 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (315 votes). Check out past polls.