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..
In reply to require 'package' by sangam1
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |