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
12 matches
Mail list logo