PERL for Biologists

Course by Kurt Stüber

Previous, Part 6 ,Next

Subroutines:

Subroutines are a good way to structure your program into manageable parts. If in your program task appear several times you should no write the same code again but put it into a subroutine and call the subroutine several times. Subroutines should be written to be reusable, i.e. the code should independent from the rest of the program with the exceptions of the a parameters that enter and leave the subroutine.

/ABC/
/This\n/

/A\w*/

$line = s/Karl/Fred/g;

Exercises:

Solutions:


© 2001-2007, by Kurt Stüber.