Re: Array's

2009-10-05 Thread Shlomi Fish
On Monday 05 Oct 2009 22:49:47 Slick wrote: > Just clarification. At this time I have not written any of my code (dont' > know where to begin yet, however the website that I am looking at > perl.begin.org seems to have diffrent methods for one item. I have seen > @ for arrays written like this

Re: Array's

2009-10-05 Thread John W. Krahn
Slick wrote: Just clarification. At this time I have not written any of my code (dont' know where to begin yet, however the website that I am looking at perl.begin.org seems to have diffrent methods for one item. I have seen @ for arrays written like this: @myarray ,but I have also seen an ar

Re: Array's

2009-10-05 Thread Chas. Owens
On Mon, Oct 5, 2009 at 16:49, Slick wrote: > Just clarification.  At this time I have not written any of my code (dont' > know where to begin yet, snip Choose a simple project. If you are already familiar with the standard UNIX utilities, reimplementing them is a good way to learn the language.

Array's

2009-10-05 Thread Slick
Just clarification.  At this time I have not written any of my code (dont' know where to begin yet, however the website that I am looking at perl.begin.org seems to have diffrent methods for one item.  I have seen @ for arrays written like this:  �...@myarray ,but I have also seen an array per t

Re: Convert Array's into hashes

2009-08-06 Thread Bryan Harris
> How can I recall only certain keys and their corresponding values of hashes > ex : if D_103 then print " D_103 value is 2" > ex :if D_101 then print "D_101 value is 0" You may be looking for this: print "$_ value is $mycoolhash{$_}\n" if exists($mycoolhash{$_}); or more classically: if (

Re: Convert Array's into hashes

2009-08-06 Thread jet speed
On Thu, Aug 6, 2009 at 11:49 AM, Telemachus wrote: > On Thu Aug 06 2009 @ 11:19, jet speed wrote: > > @array1 = ( D_101 D_102 D_103 D_104); > > @array2 = (0 1 2 3); > > > > > > How can i convert both of these arrays into %hash, assigining the > > @array1 as keys and @array2 as values. > >use

Re: Convert Array's into hashes

2009-08-06 Thread Telemachus
On Thu Aug 06 2009 @ 11:19, jet speed wrote: > @array1 = ( D_101 D_102 D_103 D_104); > @array2 = (0 1 2 3); > > > How can i convert both of these arrays into %hash, assigining the > @array1 as keys and @array2 as values. use warnings; use strict; my @array1 = qw/D_101 D_102 D_103 D_

Re: Convert Array's into hashes

2009-08-06 Thread John W. Krahn
jet speed wrote: Hi, Hello, I have a query on converting arrays into hash.Please could you help me resolve the below. I have 2 arrays as bleow. @array1 = ( D_101 D_102 D_103 D_104); @array2 = (0 1 2 3); How can i convert both of these arrays into %hash, assigining the @array1 as keys and

Convert Array's into hashes

2009-08-06 Thread jet speed
Hi, I have a query on converting arrays into hash.Please could you help me resolve the below. I have 2 arrays as bleow. @array1 = ( D_101 D_102 D_103 D_104); @array2 = (0 1 2 3); How can i convert both of these arrays into %hash, assigining the @array1 as keys and @array2 as values. How can I

Re: Compare two array's

2004-01-07 Thread Rob Dixon
Jerry Preston wrote: > > I know that this is a no brainer, but I cannot not get it! I want to > compare two arrays and delete the same values in one array. > > foreach $j ( @a1 ) { > foreach $p ( @a2 ) { > $a2[ $p ] = undef if $a1[ $j ] == $a2 $p ]; > } > } > > What is wrong and is there

Re: Compare two array's

2004-01-07 Thread John W. Krahn
Jerry Preston wrote: > > Hi!, Hello, > I know that this is a no brainer, but I cannot not get it! I want to > compare two arrays and delete the same values in one array. > > foreach $j ( @a1 ) { > foreach $p ( @a2 ) { > $a2[ $p ] = undef if $a1[ $j ] == $a2 $p ]; > } > } > > What is

Re: Compare two array's

2004-01-07 Thread Jan Eden
Maybe the missing opening bracket on the third line? >$a2[$p] = undef if $a1[$j] == $a2[$p]; Being a beginner myself, I cannot recommend a better way. - Jan Jerry Preston wrote: >Hi!, > >I know that this is a no brainer, but I cannot not get it! I want to >compare two arrays and delete the s

Compare two array's

2004-01-07 Thread Jerry Preston
Hi!, I know that this is a no brainer, but I cannot not get it! I want to compare two arrays and delete the same values in one array. foreach $j ( @a1 ) { foreach $p ( @a2 ) { $a2[ $p ] = undef if $a1[ $j ] == $a2 $p ]; } } What is wrong and is there a better, PERL way to do this? Tha

RE: foreach and the ordering of array's

2001-09-07 Thread Bob Showalter
> -Original Message- > From: Stephen P. Potter [mailto:[EMAIL PROTECTED]] > Sent: Friday, September 07, 2001 1:37 PM > To: Bob Showalter > Cc: '[EMAIL PROTECTED]'; [EMAIL PROTECTED] > Subject: Re: foreach and the ordering of array's > > >

Re: foreach and the ordering of array's

2001-09-07 Thread Stephen P. Potter
Lightning flashed, thunder crashed and Bob Showalter whispered: | One way to supply a list to for/foreach is to use the keys() function | to retrieve a list of the keys in a hash. keys() does not return the | key values in any particular order, due to the internal representation | of a hash. I t

Re: foreach and the ordering of array's

2001-09-07 Thread Stephen P. Potter
Lightning flashed, thunder crashed and Jeffl <[EMAIL PROTECTED]> whispere d: | when you run a foreach on a hash you have no idea what order you will get | the keys unless | you sort it, then you can only get it in the order defined by sort. If you | use Tie::IxHash | on a hash you can print out th

Re: foreach and the ordering of array's

2001-09-07 Thread Stephen P. Potter
Lightning flashed, thunder crashed and Jeffrey Loetel <[EMAIL PROTECTED]> whispered: | Question: | When you extract a value from an @ are you guarenteed the order that | you are going to get? In both cases, @ and %, you will always get a predictable order. With arrays, it will always be ordere

RE: foreach and the ordering of array's

2001-09-07 Thread Jeffl
owalter > > Cc: 'beginners @ perl . org' > > Subject: RE: foreach and the ordering of array's > > > > > > when you run a foreach on a hash you have no idea what order > > you will get > > the keys unless > > you sort it, then you can

RE: foreach and the ordering of array's

2001-09-07 Thread Bob Showalter
> -Original Message- > From: Jeffl [mailto:[EMAIL PROTECTED]] > Sent: Friday, September 07, 2001 11:47 AM > To: Bob Showalter > Cc: 'beginners @ perl . org' > Subject: RE: foreach and the ordering of array's > > > when you run a foreach on a ha

RE: foreach and the ordering of array's

2001-09-07 Thread Jeffl
> -Original Message- > > From: Jeffrey Loetel [mailto:[EMAIL PROTECTED]] > > Sent: Friday, September 07, 2001 1:57 AM > > To: [EMAIL PROTECTED] > > Subject: foreach and the ordering of array's > > > > > > Question: > > When you extrac

RE: foreach and the ordering of array's

2001-09-07 Thread Bob Showalter
> -Original Message- > From: Jeffrey Loetel [mailto:[EMAIL PROTECTED]] > Sent: Friday, September 07, 2001 1:57 AM > To: [EMAIL PROTECTED] > Subject: foreach and the ordering of array's > > > Question: > When you extract a value from an @ are you guar

foreach and the ordering of array's

2001-09-06 Thread Jeffrey Loetel
he problem: before I do my join below I have two other array's one with, names and one with values (@other_names, @other_values)that I want to push into the @value_array and @name_array. The issue is not how do I do that but when I extract the values from each of the @other_names or @other_values a