Eko Budiharto wrote:
> Hi list,
> I got a few questions.
> 1. How to count the number data in an aray.
You can just use the array in a scalar context :
if (@array > 5) {
or you can force it to scalar if needed with: scalar (@array)
> 2. is there anyway that I can do converting data to something else using
> method like eof (end of file). What I mean is using while and do
> converting until the last data in array.
> my @Category = join(", ", $cgi->param('Category'));
>
> the result will comes up like this J1001, J1002
use strict;
my @cats = $cgi->param('Category');
my %cats = ('J0000' => '-', 'J1001' => 'A', 'J1002' => 'B');
my @scats = ();
push @scats, $cats{$_} || $_ foreach @cats; # convert cats to single char
my $cats = join ',', @scats; #join up
print "$cats\n";
__END__
> And then I would like to convert them into A, B (I have definitions that
> is using "if" statement)
> if ($Category eq "J0000") {
> $jCategory = "-";
> } elsif ($Category eq "J1001") {
> $Category = "A";
> } elsif ($Category eq "J1002") {
> $Category = "B";
> }
> I am sorry if I confused you guys with my writing. I am not good enough
> in describing what I mean in writing.
--
,-/- __ _ _ $Bill Luebkert Mailto:[EMAIL PROTECTED]
(_/ / ) // // DBE Collectibles Mailto:[EMAIL PROTECTED]
/ ) /--< o // // Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_ http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs