Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re:{3} How to compare arrays? (xmms alarm clock)

by jeroenes (Priest)
on Jun 29, 2001 at 10:14 UTC ( #92537=note: print w/replies, xml ) Need Help??


in reply to Re: Re: How to compare arrays? (xmms alarm clock)
in thread How to compare arrays? (xmms alarm clock)

See How to test equality of hashes? for more ways.

You can leave out the @timenow:

@current = (localtime time)[1..2];
...just gives you the slice.

Hope this helps,

Jeroen

Update: You're welcome. That prob is easily solved with reverse:

@current = reverse (localtime time)[1..2];

Replies are listed 'Best First'.
Re: Re:{3} How to compare arrays? (xmms alarm clock)
by ginseng (Pilgrim) on Jun 29, 2001 at 10:36 UTC

    This leaves @current with a different array order than @wake has. split /:/ leaves $wake[0] with the hour, and $wake[1] with the minute. localtime[1..2] would return the minute then the hour. to do the comparison, i'd have to invert one array.

    thank you for the hashes link. i'm glad i didn't find it before posting this question. it makes this question look way too easy. as you can see, i've got one solution that works, "@array1" eq "@array2", but it still seems like there'd be a simpler (rather, more intuitive) way. But perhaps my intuition is just not on yet, with Perl.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://92537]
help
Chatterbox?
[Discipulus]: choroba if let your company to hire Tanktalus and marioroy ... what a big fishing!
[Discipulus]: i choice prague!!
[choroba]: 1200 years is enough :-)
[marioroy]: Lady_Aleena my $ans = qx! find . -name "*.pl" -exec ls -l {} \\; !;
[Tanktalus]: My basic problem right now is that if I were willing to move, I could be back in Toronto with a pay raise. We have a number of reasons for not wanting to do that.
[marioroy]: I had to backslash the backslash inside qx.
[Tanktalus]: marioroy++ # nice catch
[Lady_Aleena]: marioroy, that makes kinda makes sense.
[Discipulus]: yes i can survive also in younger town.. but when i passed i saw many strange letters..
[Lady_Aleena]: marioroy, sorry, I am not making sense right now.

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2017-04-23 20:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (432 votes). Check out past polls.