Help for this page

Select Code to Download


  1. or download this
    my $thing_to_find = 'needle';
    my @haystack = ('needle', 'hay', 'more hay', 'yet more hay');
    my $needle_count = scalar(grep { /^$thing_to_find$/ } @haystack);
    
  2. or download this
    sub getAnswer {
      my $ans;
    ...
      chomp($ans);
      return $ans;
    }
    
  3. or download this
    sub pad {
      my ($str, $padSize, $padChar, $dir) = @_;
    ...
      }
      return $str;
    }