Re: Problem with hash value

2001-06-29 Thread Michael Fowler
On Sat, Jun 30, 2001 at 12:28:11AM +0200, M.W. Koskamp wrote: > From: Wang, Lanbo <[EMAIL PROTECTED]> > > Hi Members, > > #!/usr/local/bin/perl > > > > sub card{ > > > > my %card_map; > > my ($num)=@_; > > @card_map{1..9}= qw(one two three four five six seven eight nine); > > You are putting

Re: Problem with hash value

2001-06-29 Thread Michael Fowler
On Fri, Jun 29, 2001 at 06:04:33PM -0400, Wang, Lanbo wrote: > #!/usr/local/bin/perl This is your first mistake. You forgot -w and use strict; always use both when debugging code. It wouldn't have helped you here, but I guarantee you it will in the future. So: #!/usr/local/bin/perl -w us

Re: Problem with hash value

2001-06-29 Thread Paul
--- Me <[EMAIL PROTECTED]> wrote: > > > my ($num) = @_; > > > > > > puts the length of @_ in $num. I don't think so? The parens should give $num a list context. It should have the first value in @_. Right? __ Do You Yahoo!? Get personaliz

Re: Problem with hash value

2001-06-29 Thread Abdulaziz Ghuloum
> while (<>) { >chomp; >print "card of $_ is:" &card($_), "\n"; > } ^ Add a comma (,) or a string cat (.) between the quote and the function :-) Aziz,,, On Fri, 29 Jun 2001 18:04:33 -0400, Wang, Lanbo said: > Hi Members, > > It seemed that a value

Re: Problem with hash value

2001-06-29 Thread Me
> > I would think you are always getting 'one', right? > > > > That's because: > > > > my ($num) = @_; > > > > puts the length of @_ in $num. Sorry, I'm being an idiot. You were doing the right thing. > $ more number > 3 > 5 > $test10.pl < number > ``rd > bard Hmm. > print "card of $

Re: Problem with hash value

2001-06-29 Thread Me
> > sub card{ > > > > my %card_map; > > my ($num)=@_; > > @card_map{1..9}= qw(one two three four five six seven eight nine); > > You are putting the numbers 0..9 in the array @card_map here, not in the > hash %cardmap. No he isn't. (He's using a hash slice, which is fine.) I would think you

Re: Problem with hash value

2001-06-29 Thread M.W. Koskamp
- Original Message - From: Wang, Lanbo <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, June 30, 2001 12:04 AM Subject: Problem with hash value > Hi Members, > > It seemed that a value was incorrectly retrieved from the hash list in the > fol

Problem with hash value

2001-06-29 Thread Wang, Lanbo
Hi Members, It seemed that a value was incorrectly retrieved from the hash list in the following small Perl script. . #!/usr/local/bin/perl sub card{ my %card_map; my ($num)=@_; @card_map{1..9}= qw(one two three four five six seven eight nine); if ($card_map{$num}) { $card_map{$num