Re: reference to a hash

2006-04-16 Thread tom arnall
> $ perl -le' > sub foo { > for ( @_ ) { > tr/a-z/A-Z/ > } > } > my @a = qw/ a b c d e f g h i j /; > print "@a"; > foo @a; > print "@a"; > my %h = qw/ a b c d e f g h i j /; > print "@{[ %h ]}"; > foo %h; > print "@{[ %h ]}"; > ' > a b c d e f g h i j > A B C D E F G H I J

Re: reference to a hash

2006-04-15 Thread Mr. Shawn H. Corey
On Sat, 2006-15-04 at 14:34 -0700, John W. Krahn wrote: > Actually it will effect the values of the hash but not the keys: > > $ perl -le' > sub foo { > for ( @_ ) { > tr/a-z/A-Z/ > } > } > my @a = qw/ a b c d e f g h i j /; > print "@a"; > foo @a; > print "@a"; > my %h = q

Re: reference to a hash

2006-04-15 Thread John W. Krahn
Mr. Shawn H. Corey wrote: > On Sat, 2006-15-04 at 09:32 -0400, Steve Bertrand wrote: >>Just out of curiosity, if you pass the hash, won't it create a 'copy' of >>the original, manipulate it so that in the end you may have two >>different versions (modifications) of the same hash? >> >>As I underst

Re: reference to a hash

2006-04-15 Thread Chad Perrin
On Sat, Apr 15, 2006 at 06:09:04AM -0700, John W. Krahn wrote: > Chad Perrin wrote: > > On Fri, Apr 14, 2006 at 12:18:33PM -0400, Brian Volk wrote: > >>I'm working through the exercises in the Alpaca book. I don't > >>understand why you have to pass the check_items_for_all subroutine a > >>referen

RE: reference to a hash

2006-04-15 Thread Mr. Shawn H. Corey
On Sat, 2006-15-04 at 09:32 -0400, Steve Bertrand wrote: > Just out of curiosity, if you pass the hash, won't it create a 'copy' of > the original, manipulate it so that in the end you may have two > different versions (modifications) of the same hash? > > As I understand it, if you pass a href,

RE: reference to a hash

2006-04-15 Thread Steve Bertrand
> > I'm working through the exercises in the Alpaca book. I don't > > understand why you have to pass the check_items_for_all > subroutine a > > reference to a hash. Why can't you just pass it the hash itself... > > check_items_for_all(%all) instead for (\%all) ? Could someone pls > > expla

Re: reference to a hash

2006-04-15 Thread John W. Krahn
Brian Volk wrote: > Hi All, Hello, > I'm working through the exercises in the Alpaca book. I don't > understand why you have to pass the check_items_for_all subroutine a > reference to a hash. Why can't you just pass it the hash itself... > check_items_for_all(%all) instead for (\%all) ? Could

Re: reference to a hash

2006-04-15 Thread John W. Krahn
Chad Perrin wrote: > On Fri, Apr 14, 2006 at 12:18:33PM -0400, Brian Volk wrote: >>I'm working through the exercises in the Alpaca book. I don't >>understand why you have to pass the check_items_for_all subroutine a >>reference to a hash. Why can't you just pass it the hash itself... >>check_item

Re: reference to a hash

2006-04-14 Thread Chad Perrin
On Fri, Apr 14, 2006 at 12:18:33PM -0400, Brian Volk wrote: > > I'm working through the exercises in the Alpaca book. I don't > understand why you have to pass the check_items_for_all subroutine a > reference to a hash. Why can't you just pass it the hash itself... > check_items_for_all(%all) in

Re: reference to a hash

2006-04-14 Thread Owen Cook
On Fri, 14 Apr 2006, Brian Volk wrote: > > > I'm working through the exercises in the Alpaca book. I don't > understand why you have to pass the check_items_for_all subroutine a > reference to a hash. Why can't you just pass it the hash itself... > check_items_for_all(%all) instead for (\%all