perlgurl1020 has asked for the wisdom of the Perl Monks concerning the following question:

I'm looking to create a webutils package as an assignment. The purpose is because I have several scripts using the same code and I would like to condense it to make it a bit more efficient and less redundant. I would like to create global variables. I am looking for code examples. What I have so far:
#!/usr/bin/perl package WebUtil sub http_header { CGI::header(); } sub html_header { return "<!DOCTYPE html>; } sub start_app { $WebUtil::dbh my($db) = @_; $dbh = DBI->connect("dbi:mysql:cmd",$userid,$password); return $dbh; }
Thank you!

Replies are listed 'Best First'.
Re: Creating a webutil mod/package
by Anonymous Monk on Aug 14, 2015 at 03:13 UTC
      Thank you that helped, I was overthinking it. I just created several subroutines and called them in each script and it worked.