Re: % with perl

2001-06-20 Thread will trillich
On Tue, Jun 19, 2001 at 11:35:08PM +, Robin Gerard wrote: > On Mon, Jun 18, 2001 at 12:56:11PM -0500, will trillich wrote: > > try > > > > perldoc -f each > > perldoc -f keys > > ok it's just what I need. > > > the camel book and the llama book are both wonderful resources > > (for

Re: % with perl

2001-06-19 Thread Robin Gerard
On Mon, Jun 18, 2001 at 12:56:11PM -0500, will trillich wrote: > On Mon, Jun 18, 2001 at 01:24:28AM +, Robin Gerard wrote: > > this script runs fine: > > > try > > perldoc -f each > perldoc -f keys ok it's just what I need. > the camel book and the llama book are both won

Re: % with perl

2001-06-18 Thread will trillich
On Mon, Jun 18, 2001 at 01:24:28AM +, Robin Gerard wrote: > this script runs fine: > > #!/usr/local/bin/perl > > print "\n\n"; > %loginpsswd=("gerard","12345678","jaimie","78945612","andy","45632178"); for clarity, you should usually write hash-list expressions with the => operator:

Re: % with perl

2001-06-17 Thread Dave Carrigan
Robin Gerard <[EMAIL PROTECTED]> writes: > %loginpsswd=("gerard","12345678","jaimie","78945612","andy","45632178"); > print $loginpsswd{"gerard"}; > print $loginpsswd{"$loginpasswd[2*$i]"}; A hash variable is not the same symbol as an array variable. %loginpasswd is a hash variable @logi

Re: % with perl

2001-06-17 Thread Jonathan Daugherty
> $i=0; > while ($i<3) > { > print $loginpsswd{"$loginpasswd[2*$i]"}; > print "\n\n"; > } > I get error ... > > can someone whose knows perl explain me how to write > this loop correctly. An easy way is this: foreach $k (keys %loginpsswd) { print $loginpsswd{$k}."\n\n"; } -- Jonathan