On 2011-08-18 21:58, Dr.Ruud wrote:
On 2011-08-18 16:51, Zak wrote:
can you reference elements of an array/hash from within that array/
hash for example would
@array=(A, B, C, D, $array[0], E, F)
fly?
See Data::Alias and Array::RefElem.
perl -Mstrict -MData::Dumper -MData::Alias -wle '
". $i . ":" . $sorted->[ $i ]->[ $j ]->[ 1 ] . " had "
. $sorted->[ $i ]->[ $j ]->[ 0 ] . " duplicates\n" if( $sorted->[ $i
]->[ $j ] );
}
}
-- Forwarded message --
From: Rob Dixon
Date: Thu, Aug 18, 2011 at 17:37
Subje
On 11-08-18 10:51 AM, Zak wrote:
@array=(A, B, C, D, $array[0], E, F)
This is the same as:
{
my @temporary = @array;
@array = ( A, B, C, D, $temporary[0], E, F );
}
--
Just my 0.0002 million dollars worth,
Shawn
Confusion is the first step of understanding.
Programming is as much
On 8/18/11 Thu Aug 18, 2011 7:51 AM, "Zak"
scribbled:
> can you reference elements of an array/hash from within that array/
> hash for example would
>
> @array=(A, B, C, D, $array[0], E, F)
>
> fly?
Try it out. See what you get.
The above will not set the fifth element of @array to 'A', how
On 18/08/2011 15:51, Zak wrote:
can you reference elements of an array/hash from within that array/
hash for example would
@array=(A, B, C, D, $array[0], E, F)
fly?
You can write
my @array;
@array=('A', 'B', 'C', 'D', \$array[0], 'E', 'F');
What are you trying to do?
Rob
--
To unsub
On 2011-08-18 16:51, Zak wrote:
can you reference elements of an array/hash from within that array/
hash for example would
@array=(A, B, C, D, $array[0], E, F)
fly?
See Data::Alias and Array::RefElem.
perl -Mstrict -MData::Dumper -MData::Alias -wle '
my @data = qw(A B C D A E F A B B A);
can you reference elements of an array/hash from within that array/
hash for example would
@array=(A, B, C, D, $array[0], E, F)
fly?
Zak
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/
On Feb 19, 2004, at 1:25 PM, [EMAIL PROTECTED] wrote:
Thought i'd address the build portion below, to see if i'm not
utilizing PERL's strengths correctly. First PERL i've written in 3+
years.
Perl. The language you are relearning is called Perl, not PERL. ;)
James
--
To unsubscribe, e-mail:
Hi Jeffrey.
>> There are several questions here, so I've answered in-line.
Rob, thanks a ton. that worked perfectly, as has the rest of the
processing of the larger hash. Thought i'd address the build portion
below, to see if i'm not utilizing PERL's strengths correctly. First PERL
i've wr
Hi Jeffrey.
There are several questions here, so I've answered in-line.
Jeffrey N Dyke wrote:
>
> I had a simple array in mind, but as i got reacquainted with PERL, with the
> help of the list, i realized i was thinking to small. (that's always
> dangerous)
On the contrary, I think thinking BIG
Hello,
I had a simple array in mind, but as i got reacquainted with PERL, with the
help of the list, i realized i was thinking to small. (that's always
dangerous)
Anyway. I have an array/hash(still learning the technical differences)
similar to
(pardon syntax irregularities, just trying
Richard Heintze wrote:
> Why does "@$y[$i]" work here, and "foreach $i (keys
> %$x)" works to fetch the keys from a reference to a
> hash, but I use $$x{$i} to fetch hash reference
> element values instead of %$x{$i}?
>
> This seems very inconsistent to me.
>
Maybe, but it is really not. What y
On Saturday, May 31, 2003, at 03:51 PM, Richard Heintze wrote:
James,
I hope this is my last question. I appreciate your
(and everyone else's that has contributed)
generousity.
Not a problem. Hope I'm helping more than I'm confusing.
Why does "@$y[$i]" work here, and "foreach $i (keys
%$x)" wo
James,
I hope this is my last question. I appreciate your
(and everyone else's that has contributed)
generousity.
I have a web site I inherited where a single page has
3000 lines of perl code. It does not use strict or
warnings. The original authors only used global
variables and never used any f
On Saturday, May 31, 2003, at 02:45 PM, Richard Heintze wrote:
Can you explain this syntax then, that is used with
foreach loops?
foreach my $i (keys %{$x}) { ... }
Why don't we use foreach my $i (keys $$x){... }?
What is the name for this syntax: "(keys %{$x})"?
Oops, sorry, I meant to get to
Sorry James, you got a second copy. I meant to reply
to the group.
James,
thank you, thank you!
Can you explain this syntax then, that is used with
foreach loops?
foreach my $i (keys %{$x}) { ... }
Why don't we use foreach my $i (keys $$x){... }?
> > What is the name for this syntax: "(keys
On Saturday, May 31, 2003, at 01:47 PM, Richard Heintze wrote:
I tried "use strict;" and that worked. Are you
encouraging me to use "use warn;" too? That does not
work.
use warnings;
It will alert you to potential problems in your code, while strict
makes sure you obey the good programmer rules
Richard Heintze wrote:
>
> I have some more questions!
>
> I tried "use strict;" and that worked. Are you
> encouraging me to use "use warn;" too? That does not
> work.
use warnings;
And/or:
use diagnostics;
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTE
Richard Heintze wrote:
>
> Some help understanding this program would be greatly
> appreciated! I'm really struggling with this perl
> language!
perldoc perldata
perldoc perlreftut
perldoc perlref
perldoc perldsc
perldoc perllol
> my $x= {'d' => 'y', 'f' => 'g'},
> $y = ['a', 'b', 'c', 'd']
Thank you very much James and David! Wow! What prompt
responses!
I have some more questions!
I tried "use strict;" and that worked. Are you
encouraging me to use "use warn;" too? That does not
work.
> > # $i receives the proper values
> > foreach my $i (keys %{$x}) {
> > # (4) Why does not thi
On Saturday, May 31, 2003, at 12:51 PM, Richard Heintze wrote:
my $x= {'d' => 'y', 'f' => 'g'},
$y = ['a', 'b', 'c', 'd'];
I am surprised this works. I would write this as:
my($x, $y) = ( { d => 'y', f => 'g' }, [ qw(a b c d) ] );
The => operator automatically quotes barewords in front of
Richard Heintze wrote:
> Some help understanding this program would be greatly
> appreciated! I'm really struggling with this perl
> language!
> Thanks,
> siegfried
>
You should always use warnings and strict.
In the first portion, you had a comma after the end of $x lin
Some help understanding this program would be greatly
appreciated! I'm really struggling with this perl
language!
Thanks,
siegfried
my $x= {'d' => 'y', 'f' => 'g'},
$y = ['a', 'b', 'c', 'd'];
# This works! Good!
foreach my $i (@{$y}){ print "array i = $i\n" }
# (1) Why does
23 matches
Mail list logo