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
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
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.
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
> 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 (
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
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_
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
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
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
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
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
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
> -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
>
>
>
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
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
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
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
> -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
> -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
> -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
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
22 matches
Mail list logo