I have these following arrays :

@employees = (); # has 1000 elements
@managers = (); # has 100 elements
@staffs = (); # employees - managers

I have @employees and @managers in hand, what is the most efficient ways to print @staffs?

So far this is what I've done.
...
foreach my $emp (@employees) {
   foreach my $mgr (@managers) {
       if ($mgr eq $emp) {
          print "$emp is Manager\n";
       } else {
          print "$emp is Staff\n";
       }
   }
}
...

As you can see, the step will increase as the number of manager increase.


--

--beast


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to