Hi,
I am currently almost done with my current job.
As I am reviewing my scripts the foreach-loop started to anoy me.
I am afraid this is slowing down the script. Does anyone know a faster way to
do the following :
# ------
open(FH, "< $groupfile");
@usrs = <FH>;
close FH;
$htusr = (grep {/htuser: /} @usrs)[0] ;
$phi = (grep {/phil: /} @usrs)[0] ;
$al = (grep {/all: /} @usrs)[0] ;
@htuser = split(/ /, $htusr);
@phil = split(/ /, $phi);
@all = split(/ /, $al);
foreach $htuser(@htuser) {
chomp $htuser;
if ( "$pwuser" eq "$htuser" ) { $group = "iclab"; }
}
foreach $phil(@phil) {
chomp $phil;
if ( "$pwuser" eq "$phil" ) { $group = "phil"; }
}
foreach $all(@all) {
chomp $all;
if ( "$pwuser" eq "$all" ) { $group = "all"; }
}
if(!($group)) { $group = "none"; }
# ------
Groupfile :
htuser: user1 user2 user3 manyothers
phil: user4 user5 manymore
all: external1 external2 etc
# -------
I know I should have used Strict, after I reviewed everything I will try to make
it strict again. You guys convinced me of using strict. It's only a pain to correct
it afterwards :(
Thanks for your help in advance !
Regs David
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]