Hi Remy,

On Thursday 29 Apr 2010 12:22:40 Remy Guo wrote:
> I got the concept...but how to pass the reference? I'm really not familiar
> with the reference....too bad. :(
> 

In addition to what Akhthar said, I'd like to note that we've concentrated a 
list of online resources to learn about Perl references, here:

http://perl-begin.org/topics/references/

Please read some of them to learn more about references in Perl 5, because 
it's a very useful feature.

Regards,

        Shlomi Fish

> 
> 
> 2010/4/29 Akhthar Parvez K <akht...@sysadminguide.com>
> 
> > Hi,
> > 
> > On Thursday 29 Apr 2010, Remy Guo wrote:
> > > I've got a problem in following script:
> > > sub A  {
> > > 
> > >     our %a;
> > >     $a{"fred"} = 1;
> > > 
> > > ...
> > > }
> > > sub B {
> > > 
> > >     if ($fred != $a{"fred"})  {
> > >     
> > >         print "fred failed.\n";
> > >     
> > >     }
> > >     if ($bella != $a{"bella"}  {
> > >     
> > >         print "bella failed.\n";
> > >     
> > >     }
> > > 
> > > }
> > > 
> > > The problem is, I made the hash %a in sub A but in sub B, the value in
> > 
> > hash
> > 
> > > %a is never read. The declaration "our" seems not effect.
> > > Why?...
> > 
> > Pass the hash reference as an argument while calling the function. Do
> > remember that you can't pass the hash to a function, but just the hash
> > reference. Also minimize (or even avoid) the use of declaring with "our",
> > use argument passing instead.
> > 
> > Regards,
> > Akhthar Parvez K
> > http://Tips.SysAdminGUIDE.COM <http://tips.sysadminguide.com/>
> > 
> > UNIX is basically a simple operating system, but you have to be a genius
> > to understand the simplicity - Dennie Richie
> > 
> > --
> > To unsubscribe, e-mail: beginners-unsubscr...@perl.org
> > For additional commands, e-mail: beginners-h...@perl.org
> > http://learn.perl.org/

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
http://www.shlomifish.org/humour/ways_to_do_it.html

God considered inflicting XSLT as the tenth plague of Egypt, but then
decided against it because he thought it would be too evil.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to