Blog
Developers
Careers
Support
Contact
Gossamer Threads
Solutions
Results
About
Mailing Lists
Resource Centre
Forum
Tools
Home
Who's Online
Tags
Favourites
Login
Forum Search
(
Advanced Search
)
This forum
This category
All forums
for
Home
:
Products
:
DBMan
:
Customization
:
If them problem
Previous Thread
Next Thread
Print Thread
View Threaded
Jun 23, 2002, 4:18 PM
TRD2
Novice
(11 posts)
Jun 23, 2002, 4:18 PM
Post #1 of 7
Views: 2932
Shortcut
If them problem
How do I write the following in perl and where do I put it?
If State = NC then Tribe = Sector 10
Thanks
Jun 26, 2002, 1:22 AM
chmod
User
(235 posts)
Jun 26, 2002, 1:22 AM
Post #2 of 7
Views: 2784
Shortcut
Re: [TRD2] If them problem
In reply to
Try,
Code:
if ($in{'State'} eq 'NC') { $in{'Tribe'} = 'Sector 10'; }
pop it into sub add_record near the beggining.
chmod
Jun 26, 2002, 3:18 AM
Paul
Veteran
(19537 posts)
Jun 26, 2002, 3:18 AM
Post #3 of 7
Views: 2781
Shortcut
Re: [chmod] If them problem
In reply to
With a quick shift about you could remove the brackets....
Code:
$in{'Tribe'} = 'Sector 10' if $in{'State'} eq 'NC';
Last
edited
by:
Paul
: Jun 26, 2002, 3:18 AM
Jun 26, 2002, 4:40 AM
chmod
User
(235 posts)
Jun 26, 2002, 4:40 AM
Post #4 of 7
Views: 2789
Shortcut
Re: [Paul] If them problem
In reply to
My way is easier and neater if you want to test for multiple conditions using elsif`s.
I reckon thats what he will want to do.
chmod
Jun 26, 2002, 4:45 AM
Paul
Veteran
(19537 posts)
Jun 26, 2002, 4:45 AM
Post #5 of 7
Views: 2777
Shortcut
Re: [chmod] If them problem
In reply to
Code:
my $tribes = { NC => 'Sector 10', LA => 'Sector 12' };
$in{Tribe} = $tribes->{$in{State}} if defined $tribes->{$in{State}};
Thats a way you can do it without loads of elsif's....you'd just add the state/sector into the hashref.
Last
edited
by:
Paul
: Jun 26, 2002, 4:47 AM
Jun 26, 2002, 8:47 AM
chmod
User
(235 posts)
Jun 26, 2002, 8:47 AM
Post #6 of 7
Views: 2771
Shortcut
Re: [Paul] If them problem
In reply to
Paul,
cheers I learn a lot from people like you.
And your especially good at actually giving a code example rather than just saying "use a hash", its all much appreciated.
chmod
Jun 28, 2002, 2:14 PM
TRD2
Novice
(11 posts)
Jun 28, 2002, 2:14 PM
Post #7 of 7
Views: 2747
Shortcut
Re: [Paul] If them problem
In reply to
Ok -
I'm new at this so you have forgive this question, but i need to know -
I'm guessing I take this string and put it in the default.cfg file after the Checkbox fields suff
my $tribes = { NC => 'Sector 10', LA => 'Sector 12' };
My big question is where and what file do i put this string -
$in{Tribe} = $tribes->{$in{State}} if defined $tribes->{$in{State}};
I would guess the html.pl file, but where to use it I dont have a clue.
Help!!
Last
edited
by:
TRD2
: Jun 28, 2002, 2:15 PM
Previous Thread
Next Thread
Print Thread
View Threaded