# File: mymodules.pm # in order to incorporate the module in your program # say at the beginning: (see usemodule.pl) # use mymodules; # call as: printGroup( $string, $integer) # prin a string $n chars on a line and jump to next line sub printGroup { my($s,$n) = @_; # group of $n for ($i = 0; $i < length($s) ; $i = $i + $n ) { my $g = substr($s,$i,$n); # find Group of $n starting form position $i print $g, "\n"; } return; } # given a string choose a random char from the string # randChar(String) -> char sub randChar { my($s) = @_; my($pos) = int rand(length $s); my($c) = substr($s,$pos,1); return $c; } #always end module with 1 1