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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: (2) Flawless Script problems?
by sulfericacid (Deacon) on Mar 13, 2003 at 18:37 UTC |