Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: What is the significance of a package

by muba (Priest)
on Jul 06, 2012 at 23:05 UTC ( #980395=note: print w/replies, xml ) Need Help??

in reply to What is the significance of a package

One important feature is that packages give you namespaces. Entries with identical names can co-exist because they live in different namespaces. As to demonstrate:

### use strict; use warnings; use Bar; use subs qw(foo); foo; sub foo { print "Foo, from the main package.\n"; }
### package Bar; use strict; use warnings; sub foo { print "Also foo, but this comes from the Bar package.\n"; print "(And no, if my wife calls, I'm not at the bar!)\n"; }

Try to do this without packages, and Perl will rightfully complain, "Subroutine foo redefined at ...". Which is hardly ever what you want.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://980395]
[stevieb]: here I thought my Perl code was wrong, but it turns out I had a poor miscoonception of [https://arduino. questions/42879/ reading-an-output- analog-pin-with-an -input-analog-pin
[stevieb]: meh... I'll try again
[stevieb]: I thought my Perl code was bad, but I misunderstood Arduino pins.

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (4)
As of 2017-07-22 03:32 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (336 votes). Check out past polls.