Help for this page

Select Code to Download


  1. or download this
        if ($numbers[0] > 50) {
            push (@array,$numbers[0]) }
        if ($numbers[1] > 50) {
    ...
            push (@array,$numbers[2]) }
        if ($numbers[3] > 50) {
            push (@array,$numbers[3]) }
    
  2. or download this
        $sum += 2;
        push(@array,2);
    ...
        push(@array,4);
        $sum += 6;
        push(@array,6);
    
  3. or download this
    for (@numbers) {
        push @array, $_ if $_ > 50;
    }
    
  4. or download this
    for my $current (@numbers) {
        if ($current > 50) {
            push @array, $current;
        }
    }