The distinctive Perl camel is (c) O'Reilly
Perl Workshop Home Page
Home of the Bioinformatics Perl Workshop perl workshop > courses > introduction to perl (1.0.1.8) > Subroutines and Special Variables (.6/8) > sub-02 (.c6)

course 1.0.1.8

Level: beginner
1.0.1.8.6
$_; other special variables; introduction to subroutines; passing arguments; @_; named arguments; call context

legend

course code

cat.course.level.sessions.session

e.g. 1.0.1.8

categories

0 | introduction and orientation

1 | perl fundamentals

2 | shell and prompt tools

3 | web development

4 | CPAN Modules

5 | Ruby

levels

level: all all ( 0 )

level: beginner beginner ( 1 )

level: intermediate intermediate ( 2 )

level: advanced advanced ( 3 )

[ have you wondered how many different banners there are? ]

lecture code viewer

downloads

Code
Subroutines and Special Variables
Subroutines and Special Variables
Martin Krzywinski
#!/usr/local/bin/perl $\ = "\n"; $, = " "; $x = simulate_failure(); print "failure scalar x" if ! defined $x; @x = simulate_failure(); print "failure array x" if ! defined @x; sub simulate_failure { return; }

6 | Subroutines and Special Variables | 1.0.1.8.6

1.0.1.8.6.c1 | loop-01 | Martin Krzywinski | code
1.0.1.8.6.c2 | loop-02 | Martin Krzywinski | code
1.0.1.8.6.c3 | loop-03 | Martin Krzywinski | code
1.0.1.8.6.c4 | loop-04 | Martin Krzywinski | code
1.0.1.8.6.c5 | sub-01 | Martin Krzywinski | code
1.0.1.8.6.c6 | sub-02 | Martin Krzywinski | code
1.0.1.8.6.a1 | Subroutines and Special Variables | Martin Krzywinski | pdf
1.0.1.8.6.p1 | Subroutines and Special Variables | Martin Krzywinski | ppt
1.0.1.8.6.s1 | Subroutines and Special Variables | Martin Krzywinski | slides