KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Before writing this program,I thought that our is a package scope variable and my is a file scope variable.But,After did that program,I am get confused. My program is, #!/usr/bin/perl use strict; use warnings; package one; our $val = "sat"; my $new = "hello"; print "ONE:val =>$val \n"; print "ONE:new =>$new \n\n"; package two; print "TWO:val =>$val \n"; print "TWO:new =>$new \n"; which outputs ONE:val =>sat ONE:new =>hello TWO:val =>sat TWO:new =>hello So,what is the difference between my and our .Whether the both are the same or it having any difference?
Tags (comma-separated)
Save Edits
Cancel