that all works fine (exept my many to many
problem i noted above). my issue is how to print out a slice of an arrayref
of a hashref?
my underlying problem (i think) is that there has got to be a better way?
i've got half a mind to create a temp table in the db to do this, but that
doesn't s
elavazhagan perl wrote:
> Hi..
>
> Thanks Rob,with ur code ,Now I can display all the countries with
> regions.Now i would like to display only countries specific to the region.
> We can split the data and assign into two different arrays.Let me know is
> there any specific way to retrive the
08 12:00
To: Dr.Ruud; [EMAIL PROTECTED]
Cc: beginners@perl.org
Subject: Re: arrayref
Hi..
Thanks Rob,with ur code ,Now I can display all the countries with
regions.Now i would like to display only countries specific to the
region.
We can split the data and assign into two different arrays.Let
Hi..
Thanks Rob,with ur code ,Now I can display all the countries with
regions.Now i would like to display only countries specific to the region.
We can split the data and assign into two different arrays.Let me know is
there any specific way to retrive the data ??
Thanks a lot
#!
"elavazhagan perl" schreef:
> #Start
> #! /usr/local/perl/bin
> use strict;
The shebang-line should be the first one.
"use warnings;" is missing.
--
Affijn, Ruud
"Gewoon is een tijger."
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://l
elavazhagan perl wrote:
>
> Please have a glance on the following code and suggest me to purify it.
> My requirement is when the user choose the region,I need to display the
> countries specific to that regions.
> I have been trying in both hash and array references.This one is
Hi,
Please have a glance on the following code and suggest me to purify it.
My requirement is when the user choose the region,I need to display the
countries specific to that regions.
I have been trying in both hash and array references.This one is for
arrayref.
I have already the values of
Graeme McLaren wrote:
> Hi all, I'm in need of a loop, can't seem to find what I'm looking for
> online. I want to loop over this array ref inserting each hash value into
> the DB at each iteration.I've got the following data structure which is
> assigned to $aref:
>
> my $VAR1 = [
> {
>
On Jun 18, 11:27 am, [EMAIL PROTECTED] (Graeme McLaren)
wrote:
> Hi all, I'm in need of a loop, can't seem to find what I'm looking for
> online. I want to loop over this array ref inserting each hash value into
> the DB at each iteration.I've got the following data structure which is
> assigne
Hi
On the basis of what you have mentioned, I have made a sample code.
Let me know if my understanding is different from yours.
The Perl Code is copied below :-
# cat u.pl
#!/usr/bin/perl
##!/u01/app/oracle/product/10.1.0/db_1/perl/bin/perl
#
# Hi all, I'm in need of a loop, can't seem to fin
Graeme McLaren wrote:
Hi all, I'm in need of a loop, can't seem to find what I'm looking
for online. I want to loop over this array ref inserting each hash
value into the DB at each iteration.I've got the following data
structure which is assigned to $aref:
$VAR1 = [
{
On Wed, Jun 18, 2008 at 12:27 PM, Graeme McLaren <
[EMAIL PROTECTED]> wrote:
>
> Hi all, I'm in need of a loop, can't seem to find what I'm looking for
> online. I want to loop over this array ref inserting each hash value into
> the DB at each iteration.I've got the following data structure whic
Hi all, I'm in need of a loop, can't seem to find what I'm looking for online.
I want to loop over this array ref inserting each hash value into the DB at
each iteration.I've got the following data structure which is assigned to $aref:
$VAR1 = [ {'rate' => '1.98',
ECTED]]
> > Sent: Wednesday, July 10, 2002 12:26 PM
> > To: Timothy Johnson; [EMAIL PROTECTED]
> > Cc: Shawn; Connie Chan; [EMAIL PROTECTED]
> > Subject: more example code Re: help dereferencing arrayref so
> > I can put
> > the value into a hash
> &g
dereference an already dereferenced arrayref?
zack
"Bob Showalter" <[EMAIL PROTECTED]> wrote in message
2E4528861499D41199D200A0C9B15BC031BBA6@FRISTX">news:2E4528861499D41199D200A0C9B15BC031BBA6@FRISTX...
> > -Original Message-
> > From: Zachary Buckh
On Jul 10, bob ackerman said:
>you get a warning with @x[2] if 'x' is an array,
>but no warning with @$x[2] where 'x' is an array ref.
>so perl isn't handling quite the same.
Well, let me refer to the source. toke.c is where the "scalar value @x[1]
better written as $x[1]" comes from. To raise
On Wednesday, July 10, 2002, at 09:05 AM, Jeff 'japhy' Pinyan wrote:
> On Jul 10, bob ackerman said:
>
>> and, as someone pointed out, this does work:
>> $x = ['abc','def','ghi'];
>> print @$x[2]."\n"; # prints 'ghi'
>>
>> but i couldn't tell you how perl reads this, except to say that '@
>Am I alone in thinking that $x->[2] is much more readable that @$x[2] or
$$x[2]?
IMHO, you are just asking for trouble whenever you use notation like
"$$x[2]". You should always put the curly braces around the scalar being
dereferenced to be sure that you or someone reading your code doesn't
On Jul 10, bob ackerman said:
>> All lists get auto-cast into a scalar, in scalar context. An array slice
>> is merely a list of array elements.
>>
>> $x = @y[2];
>>
>> is the same as
>>
>> $x = ($y[2]);
>
>except you will get warnings on these lines.
Perl warns about @x[$i] because it was
> -Original Message-
> From: Zachary Buckholz [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 10, 2002 12:26 PM
> To: Timothy Johnson; [EMAIL PROTECTED]
> Cc: Shawn; Connie Chan; [EMAIL PROTECTED]
> Subject: more example code Re: help dereferencing arrayref so
>
On Wednesday, July 10, 2002, at 09:39 AM, Jeff 'japhy' Pinyan wrote:
> On Jul 10, George Schlossnagle said:
>
>> Am I alone in thinking that $x->[2] is much more readable that @$x[2]
>> or $$x[2]?
>
> No; I always use the $ref->... syntax, unless I'm golfing.
>
>> @b[2] is an array slice with
On Jul 10, George Schlossnagle said:
>Am I alone in thinking that $x->[2] is much more readable that @$x[2]
>or $$x[2]?
No; I always use the $ref->... syntax, unless I'm golfing.
>@b[2] is an array slice with a single element (which strangely seems to
>get auto-cast as a scalar).
All lists
On Wednesday, July 10, 2002, at 09:29 AM, George Schlossnagle wrote:
>> and, as someone pointed out, this does work:
>> $x = ['abc','def','ghi'];
>> print @$x[2]."\n"; # prints 'ghi'
>
>
> Am I alone in thinking that $x->[2] is much more readable that @$x[2]
> or $$x[2]?
i was only sa
s);
}
sub get_pct_up_time($sum_checks, $sum_errors) {
my $sum_checks = $_[0];
my $sum_errors = $_[1];
my @pct_up_time;
for(my $i = 0; $i <= 6; $i++) {
if(@$sum_checks[$i] == 0) {next;};
my $sum_good = @$sum_checks[$i] - @$sum_errors[$i];
$pct_up_time[$i] = (($sum_good * 100) /
> and, as someone pointed out, this does work:
> $x = ['abc','def','ghi'];
> print @$x[2]."\n"; # prints 'ghi'
Am I alone in thinking that $x->[2] is much more readable that @$x[2]
or $$x[2]?
>
> but i couldn't tell you how perl reads this, except to say that '@$x'
> dereferences and
On Jul 10, bob ackerman said:
>and, as someone pointed out, this does work:
>$x = ['abc','def','ghi'];
>print @$x[2]."\n"; # prints 'ghi'
>
>but i couldn't tell you how perl reads this, except to say that '@$x'
>dereferences and then '[2]' gets the array element.
>but i don't know why a '$
On Wednesday, July 10, 2002, at 01:31 AM, Janek Schleicher wrote:
> Shawn wrote at Wed, 10 Jul 2002 09:59:54 +0200:
>
>> I think what you are looking for is:
>> $avg_resp_time->[0]
>>
>> if you want to have the '@' at the front, I think you would need
>> something like this:
>> @{$avg_resp_t
Shawn wrote at Wed, 10 Jul 2002 09:59:54 +0200:
> I think what you are looking for is:
> $avg_resp_time->[0]
>
> if you want to have the '@' at the front, I think you would need something like this:
> @{$avg_resp_time}[0]
>
What should be better written as
${$avg_resp_time}[0]
if you want to
s:
$avg_resp_time is an array reference. Get the first element of the
dereferenced array.
##
-Original Message-
From: Zachary Buckholz [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 09, 2002 11:31 PM
To: [EMAIL PROTECTED]
Subject: help derefe
"Zachary Buckholz" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I understand how to use a foreach on a reference to an array as follows:
>
> my $avg_resp_time = get_avg_resp_time($durations, $url_id);
> foreach my $avg_resp(@$avg_resp_time) {
> print
> But how do I directly access one array value from the reference to the
> array?
>
> print "DEBUG TEST @$avg_resp_time[0]\n";Fails
> print "DEBUG TEST @$avg_resp_time->[0]\n";Fails
> print "DEBUG TEST @{$avg_resp_time[0]}\n";Fails
>
Why don't just
print "DEBUG TEST $avg_resp_time
2002 4:31 PM
To: [EMAIL PROTECTED]
Subject: help dereferencing arrayref so I can put the value into a hash
I understand how to use a foreach on a reference to an array as follows:
my $avg_resp_time = get_avg_resp_time($durations, $url_id);
foreach my $avg_resp(@$avg_resp_time) {
print
I understand how to use a foreach on a reference to an array as follows:
my $avg_resp_time = get_avg_resp_time($durations, $url_id);
foreach my $avg_resp(@$avg_resp_time) {
print "AVG = $avg_resp\n";
}
But how do I directly access one array value from the reference to the
array?
print "
33 matches
Mail list logo