sangam1 has asked for the wisdom of the Perl Monks concerning the following question:
Question: I would like to execute the block of code in program package which is not contained in any subroutine#!/usr/local/bin/perl print "In the main package\n"; #require "program"; &program::simple(); die; package program; print "how to print this"; sub simple { print "Hi from program::simple\n\n"; } As expected the output is In the main package Hi from program::simple Died at ./x.pl line 5.
ie.. I would like it to print 'how to print this' which is not in any subroutine... Thus I want to uncomment line require 'program'.
Both the package have to be in the same file.
Looking the help of fellow monks.
Thanks..
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: require 'package'
by arturo (Vicar) on Feb 01, 2001 at 02:51 UTC | |
|
Re: require 'package'
by btrott (Parson) on Feb 01, 2001 at 02:51 UTC | |
|
Re: require 'package'
by Fastolfe (Vicar) on Feb 01, 2001 at 03:38 UTC |