CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,835

    Separating out common code

    Suppose I have a bunch of Perl scripts and they all need some code lines that will be identical in every script. Is there anything similar to #include as seen in C and C++?

    In this particular case, the lines would be data variables - so I'd be looking for something equivalent to #include <whatever.h>. However, if the lines were in fact, executable functions, it might be useful to have something equivalent to #include <whatever.c>

    Any way to do this kind of thing with Perl?
    "A problem well stated is a problem half solved.” - Charles F. Kettering

  2. #2
    Join Date
    May 2002
    Posts
    10,943

    Re: Separating out common code

    Any reason why you don't just use require?
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  3. #3
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,835

    Re: Separating out common code

    Thanks, tha's exactly what I was looking for!

    I'm following one of those "Teach Yourself" books and I'd scoured the index looking for words like "include", "import", "sources", "modules" etc etc but I couldn't find any clue. "require" is what I wanted.
    "A problem well stated is a problem half solved.” - Charles F. Kettering

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured