Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^2: Perl "new" command

by akagrawal3 (Beadle)
on Mar 01, 2012 at 10:19 UTC ( #957148=note: print w/replies, xml ) Need Help??


in reply to Re: Perl "new" command
in thread Perl "new" command

Foo::bar("Foo", $baz) what is Foo here. Is it a name of a routine or just a typical scalar value?

Replies are listed 'Best First'.
Re^3: Perl "new" command
by tobyink (Abbot) on Mar 01, 2012 at 11:31 UTC

    The first Foo is the name of a package, as in...

    package Foo; sub bar { print "Inside the package, I am called 'bar'\n"; print "But outside the package, I am called Foo::bar\n"; }

    The second "Foo" is just a string scalar.

    I really think you need to read perlboot from start to finish.

      In that example, the sub can be called as Foo::bar() regardless whether you are inside or outside the package. It's just that inside the package, the sub can also be called as bar().

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://957148]
help
Chatterbox?
[oakbox]: Anyone else having difficulty looking at search.cpan.org?
[oakbox]: I keep getting a proxy error.
[marto]: try http://metacpan. org/
[marto]: I can't access search.cpan right now either. I prefer the metacpan search and general formatting anyway. Also it seems faster
[oakbox]: Yeah, the front page of cpan.org uses metacpan.org now for search results
[oakbox]: but there are a billion links 'out there' linking to search.cpan.org.
[marto]: yep :)
[Discipulus]: being her marto, can you explain what "Par for the course I'm afraid." means?

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2017-07-26 10:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (388 votes). Check out past polls.