Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: (2) Flawless Script problems?

by AcidHawk (Vicar)
on Mar 13, 2003 at 08:35 UTC ( [id://242618]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Flawless Script problems?
in thread Flawless Script problems?

Perhaps a brief explination is in order.

When you enter the option f (for Find) and ask who you want to look for. The answer is captured into $f. I have then run the &find subroutine passing it the name that was received ie: &find($f).

This function I enclosed in an if not block to check the return of &find. So if the return, from &find, is 0(fail) then &find could not find a matching name otherwise &find returned a 1(pass).

The &find subroutine is easy to explain...

First you set a var to 0 (ie: $rc = 0;) this is what will be returned if NO match is found.

Next we make a local var for &find = the name ($f) we sent to the sub-routine. This is done using shift.

After that, all we do is, check if foreach key in the hash, equals the name we entered (now $f in &find). If it matches we set $rc to 1 and stop searching through the hash.
&find returns the var $rc.

Hope that doesn't comfuse you further.
Cheers

-----
Of all the things I've lost in my life, its my mind I miss the most.

Replies are listed 'Best First'.
Re: Re: (2) Flawless Script problems?
by sulfericacid (Deacon) on Mar 13, 2003 at 18:37 UTC
    Thanks for all your help AcidHawk, I'll review your code some more to ensure I know what you did. Thanks again!

    "Age is nothing more than an inaccurate number bestowed upon us at birth as just another means for others to judge and classify us"

    sulfericacid

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-04-20 02:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found