I thought it might be alittle cryptic when I reread it.
This is the part of the program in question
$search_str = $x->param('search_str');
$choice = $x->param('choice'); (Choice is a html select of emailname or accountnumber)
if ($choice eq accountnumber) {
$search_str = &padacctno($x->param('search_str');
$check_results = &sybase_acct_search($search_str); <--- I want this search_str
variable to be the new padded accountnumber however my $search_str =
&padacctno)$x->param('search_str') doesn't seem to like this)
} else {
$check_results = &sybase_acct_search($search_str) <-- if the user chooses to search
by emailname instead it goes here. This part is working fine).
}
I hope that's alittle better of an explanation. I was getting frantic yesterday
because I need to get this thing done ASAP.
Thanks,
Darryl
-----Original Message-----
From: Curtis Poe [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 30, 2002 7:18 PM
To: Darryl Schnell; [EMAIL PROTECTED]
Subject: Re: Question Regarding select variables and sub routines
--- Darryl Schnell <[EMAIL PROTECTED]> wrote:
> Forgive all the questions however now I've stumbled accross another problem that has
>me baffled.
>
> In the search routine I am working on I have a variable
>
> $search_str = $x->param('search_str')
>
> Now the user inputes this string after either choosing from a select statement of
>EmailName or
> an Account Number. If it is an account number I need to have something check
>search_str to see
> if it is at least 6 numbers long and if not pad 0's to the front of the account
>number until it
> is (IE 1616 would be 001616), what I'm confused about is how I would do it.
>
> $search_str = &padacctno($search_str)
If I understood you correctly: if your account number is less than 6 digits long, pad
it with
zeroes until it is six digits. We can determine if something is an account number
because it's
all digits? (just a guess)
see "perldoc -f sprintf" and "perldoc -f printf"
# it's an account number if it's one or more digits
if ( $search_str =~ /^\d+$/ )
{
$search_str = sprintf( "%06d", $search_str ) if length $search_str < 6;
}
If that's not what you're looking for, let us know. I suspect that it's close to what
you want,
but not quite it. I really couldn't tell from your question.
Cheers,
Curtis "Ovid" Poe
=====
"Ovid" on http://www.perlmonks.org/
Someone asked me how to count to 10 in Perl:
push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//;
shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A
__________________________________________________
Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions!
http://auctions.yahoo.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]