<< Back

Subroutines

Calling

open my $file, "<", "/path/to/file" or die "Error! $@";
close $file;
my ($var1, $var2, $var3) = split /:/, $variable, 3;

my $result = get_data( $param1, $param2 );

Defining

sub get_data {
    my ($param1, $param2) = @_;
    if (not defined $param1 or not defined $param2) {
        die "Error: required arguments not found!";
    }
    
    # do some stuff ...
    
    return $value;
}
Copyright © 2009 Yet another bulletin Board. All rights reserved.