How to import and define subroutines

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Pushkin
    New Member
    • Sep 2010
    • 1

    How to import and define subroutines

    Hello,

    Could someone please help me define and imported a subroutine. I will try to make this simple.

    Script-A contains all of the processes for script-B. Script-A uses script-B as a 'use base'.
    Script-A (containing the processes) has subroutine-1 which is used by subroutine-2

    How do I import/define script-A subroutine-2 to script-B.

    On Script-A subroutine-2
    This
    Code:
    sub hellos1{
    my $self = shift;
    &say_hello_to('Dan');
    $hello1 = $hellos{'Dan'}
    print $hello1;
    }
    OR this
    Code:
    sub hellos1{
    my $self = shift;
    &say_hello_to('Dan');
    $hello1 = $hellos{'Dan'}
    print $hello1;
    }
    How do I import/define subroutine-2 ($hello1) to script-B.
    If you need to see more, I am willing show you both scripts--but they are l-o-n-g.
  • toolic
    Recognized Expert New Member
    • Sep 2009
    • 70

    #2
    The conventional way to include subroutines is to use Perl modules (packages):

    Comment

    Working...