Re: Hash Print and Delete

2003-10-10 Thread Wiggins d'Anconia
On Fri, 10 Oct 2003 12:53:48 -0700 (PDT), Jeff Westman <[EMAIL PROTECTED]> wrote: > Wiggins d'Anconia <[EMAIL PROTECTED]> wrote: > > > > > > On Fri, 10 Oct 2003 09:11:28 -0700 (PDT), Jeff Westman <[

Re: Hash Print and Delete

2003-10-10 Thread Jeff Westman
Wiggins d'Anconia <[EMAIL PROTECTED]> wrote: > > > On Fri, 10 Oct 2003 09:11:28 -0700 (PDT), Jeff Westman <[EMAIL PROTECTED]> > wrote: > > > > > > I know perl returns the last value (statement?) by default, but doesn't > it > > make it more reada

Re: Hash Print and Delete

2003-10-10 Thread Wiggins d'Anconia
On Fri, 10 Oct 2003 09:11:28 -0700 (PDT), Jeff Westman <[EMAIL PROTECTED]> wrote: > > I know perl returns the last value (statement?) by default, but doesn't it > make it more readable (or self-documenting) to the next person who may come > along

Re: Hash Print and Delete

2003-10-10 Thread Rob Dixon
Jeff Westman wrote: > > Rob Dixon <[EMAIL PROTECTED]> wrote: > > > [...snip...] > > > > >return (exists $myHash{$val1} ) ? $Hash{$val2} : undef; > > > > Likewise, 'delete' returns either the element deleted or 'undef' if > > > > it didn't exist. > > [...snip...] > > > I didn't know 'delete'

Re: Hash Print and Delete

2003-10-10 Thread Jeff Westman
Rob Dixon <[EMAIL PROTECTED]> wrote: > [...snip...] > > > >return (exists $myHash{$val1} ) ? $Hash{$val2} : undef; > > > Likewise, 'delete' returns either the element deleted or 'undef' if > > > it didn't exist. > [...snip...] > > I didn't know 'delete' returned the value as well. Simple an

Re: Hash Print and Delete

2003-10-10 Thread Rob Dixon
Jeff Westman wrote: > > Rob Dixon <[EMAIL PROTECTED]> wrote: > > > Jeff Westman wrote: > > > > > > If I have an array and want to take the first element off and return it, > > I > > > would do it like this: > > > > > >return (@myArray) ? shift(@myArray) : undef; > > > > > > How would I do simil

RE: Hash Print and Delete

2003-10-10 Thread Jeff Westman
Paul Kraus <[EMAIL PROTECTED]> wrote: > Why wouldn't you just return(shift(@myarray) Yes, this works for a normal(?) array, but I was asking about hashes. > As far as the hash why are you trying to remove it? I would assume it > because you don't have a use for it outside of the scope of the > s

Re: Hash Print and Delete

2003-10-10 Thread Jeff Westman
Rob Dixon <[EMAIL PROTECTED]> wrote: > Jeff Westman wrote: > > > > If I have an array and want to take the first element off and return it, > I > > would do it like this: > > > >return (@myArray) ? shift(@myArray) : undef; > > > > How would I do similarly with a hash? I have something like th

Re: Hash Print and Delete

2003-10-10 Thread Rob Dixon
Jeff Westman wrote: > > If I have an array and want to take the first element off and return it, I > would do it like this: > >return (@myArray) ? shift(@myArray) : undef; > > How would I do similarly with a hash? I have something like this: > > >return (exists $myHash{$val1} ) ? $Hash{$va

RE: Hash Print and Delete

2003-10-10 Thread Paul Kraus
Opps type return(shift(@myarray)) -Original Message- From: Paul Kraus [mailto:[EMAIL PROTECTED] Sent: Friday, October 10, 2003 11:46 AM To: 'Jeff Westman'; 'beginners' Subject: RE: Hash Print and Delete Why wouldn't you just return(shift(@myarray) As far as th

Re: Hash Print and Delete

2003-10-10 Thread Casey West
It was Friday, October 10, 2003 when Jeff Westman took the soap box, saying: : Question: : : If I have an array and want to take the first element off and return it, I : would do it like this: : :return (@myArray) ? shift(@myArray) : undef; : : How would I do similarly with a hash? I have s

RE: Hash Print and Delete

2003-10-10 Thread Paul Kraus
:40 AM To: beginners Subject: Hash Print and Delete Question: If I have an array and want to take the first element off and return it, I would do it like this: return (@myArray) ? shift(@myArray) : undef; How would I do similarly with a hash? I have something like this: return (exists $myH

Hash Print and Delete

2003-10-10 Thread Jeff Westman
Question: If I have an array and want to take the first element off and return it, I would do it like this: return (@myArray) ? shift(@myArray) : undef; How would I do similarly with a hash? I have something like this: return (exists $myHash{$val1} ) ? $Hash{$val2} : undef; But these l