Help for this page

Select Code to Download


  1. or download this
    foreach (@fruit{'apple','banana','plum'}){$_=1}
    
  2. or download this
    #This will NOT work as intended
    $value="'apple','banana','plum'";
    foreach (@fruit{$value}){$_=1}
    #doesn't work!
    
  3. or download this
    @array=("apple","banana");
    push @array, "plum";
    foreach (@array){$fruit{$_}=1}
    
  4. or download this
    foreach (@array){$fruit{$_}=1} # initialize fruit set