The Elite Noob has asked for the wisdom of the Perl Monks concerning the following question:
However I cannot get it to work, does anyone know i can access $bar from package/class Foo? All help is appreciated!#!/usr/bin/perl -w use strict; package Foo; # this creates a package called Foo my $bar = "Hello World"; package main; # goes back to default package of class print $Foo::bar; # this prints $bar form package Foo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: how to use packages as classes in perl?
by toolic (Bishop) on Apr 04, 2011 at 22:52 UTC | |
by LanX (Saint) on Apr 04, 2011 at 23:44 UTC | |
by The Elite Noob (Sexton) on Apr 05, 2011 at 18:04 UTC | |
|
Re: how to use packages as classes in perl?
by jwkrahn (Abbot) on Apr 04, 2011 at 23:28 UTC | |
|
Re: how to use packages as classes in perl?
by luis.roca (Deacon) on Apr 04, 2011 at 22:58 UTC | |
|
Re: how to use packages as classes in perl?
by JavaFan (Canon) on Apr 05, 2011 at 11:53 UTC | |
by The Elite Noob (Sexton) on Apr 07, 2011 at 18:07 UTC | |
|
Re: how to use packages as classes in perl?
by shawnhcorey (Friar) on Apr 05, 2011 at 13:42 UTC |