[oak perl] Can't modify map iterator in scalar assignment?

Eric Chen a1234_ec at yahoo.com
Wed Dec 8 19:43:02 CST 2004


Hi,
I have the following code

my $p=qw(1 3 4);
my @array;
if($p){
  map{$array[$_]='selected'} @{$p};
}
else{
  $array[0]='selected';
}
which works fine when I try to use triary operator

 ($p)? map{$array[$_]='selected'} @{$p} :
$array[0]='selected';

I got Can't modify map iterator in scalar assignment

any ideas?

Thanks,
Eric
 


		
__________________________________ 
Do you Yahoo!? 
Meet the all-new My Yahoo! - Try it today! 
http://my.yahoo.com 
 



More information about the Oakland mailing list