On Apr 12, 2015 8:06 AM, "Shawn H Corey" wrote:
>
> On Sat, 11 Apr 2015 21:20:22 -0700
> SSC_perl wrote:
>
> > Could someone please explain the difference between:
> >
> > %{$self->{'DATA'}} = () }
>
> %{ $self->{'DATA'} } = ();
>
> >
> > and
> >
> > $self->{'DATA'} = {}
> >
> > I w
On Sat, 11 Apr 2015 21:20:22 -0700
SSC_perl wrote:
> Could someone please explain the difference between:
>
> %{$self->{'DATA'}} = () }
%{ $self->{'DATA'} } = ();
>
> and
>
> $self->{'DATA'} = {}
>
> I was told that they are equivalent, but they're not. One
> works and the ot
Eeeks, Sorry Shlomi, I can't help thinking my German lessons have been
counter-productive...
A
On Sun, Apr 12, 2015 at 10:37 AM, Shlomi Fish
wrote:
> On Sun, 12 Apr 2015 09:36:00 +0100
> Andrew Solomon wrote:
>
> > Thank you very much Schlomi - I stand corrected!
> >
>
> You're welcome, Andrew
On Sun, 12 Apr 2015 09:36:00 +0100
Andrew Solomon wrote:
> Thank you very much Schlomi - I stand corrected!
>
You're welcome, Andrew! Just note that my name is spelled "Shlomi" - not
"Schlomi". See:
* http://www.shlomifish.org/meta/FAQ/#your_name
You can also call me "Rindolf":
http://www.sh
Thank you very much Schlomi - I stand corrected!
Frank, another way of putting what Schlomi has illustrated is that:
%{$self->{'DATA'}} = ( foo => 'bar' );
means "change the contents of the hash which $self->{'DATA'} refers to",
while
$self->{'DATA'} = { foo => 'bar' };
means "change $self->{'
Hi Andrew,
On Sun, 12 Apr 2015 07:25:55 +0100
Andrew Solomon wrote:
> Hi Frank
>
> I found the first one rather obscure, but they are equivalent.
No - they are not exactly the same. See below:
> To prove
> this, Data::Dumper is my friend:
>
> #!/usr/bin/perl
>
> use strict;
> use warnings;
On Sat, 11 Apr 2015 21:20:22 -0700
SSC_perl wrote:
> Could someone please explain the difference between:
>
> %{$self->{'DATA'}} = () }
>
> and
>
> $self->{'DATA'} = {}
The first line works on the physical reference $self->{'DATA'} and empties it.
The second one assigns a new empty refe
Hi Frank
I found the first one rather obscure, but they are equivalent. To prove
this, Data::Dumper is my friend:
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
{
my $self;
print "selfish self \n";
%{$self->{'DATA'}} = ( foo => 'bar' );
print Dumper $self;
}
{
my $self;
On Apr 12, 2015 12:23 AM, "SSC_perl" wrote:
>
> Could someone please explain the difference between:
>
> %{$self->{'DATA'}} = () }
>
The hashref of key "DATA" equals an empty list. The trailing bracket is the
end of the else block. $self is also probably blessed (an object).
ref($self->{
Could someone please explain the difference between:
%{$self->{'DATA'}} = () }
and
$self->{'DATA'} = {}
I was told that they are equivalent, but they're not. One works and
the other doesn't, so they must be different. Here's the context:
sub empty_db {
> Specifically, http://perldoc.perl.org/perlop.html#Conditional-Operator
>
> '?:' is otherwise known as the 'ternary conditional operator' -- if
> you don't know that bit of esoterica, finding the right documentation
> is a lot harder. 8^)
Thank you, everyone! It's a lot clearer to me n
On Mon, 18 Nov 2013 12:14:05 -0800
Angela Barone wrote:
> Could someone explain the format of the following line and how to
> read it?
>
> $name = $fieldname =~ /\[(.*?)\]/ ? $main::global->{'form'}->{$1} :
> $out;
It means:
if( $fieldname =~ /\[(.*?)\]/ ){
$name = $main::global->{'form
On Mon, Nov 18, 2013 at 12:34 PM, John W. Krahn wrote:
>> Also, is there something in the perl man pages about it?
>
>
> Yes. You probably want perlop?
Specifically, http://perldoc.perl.org/perlop.html#Conditional-Operator
'?:' is otherwise known as the 'ternary conditional operator' -
Angela Barone wrote:
Hello,
Hello,
Could someone explain the format of the following line and how to read
it?
$name = $fieldname =~ /\[(.*?)\]/ ? $main::global->{'form'}->{$1} : $out;
Do the contents of $fieldname match the pattern /\[(.*?)\]/? If they do
then assign $main::g
Hello,
Could someone explain the format of the following line and how to read
it?
$name = $fieldname =~ /\[(.*?)\]/ ? $main::global->{'form'}->{$1} : $out;
Also, is there something in the perl man pages about it?
Thank you,
Angela
--
To unsubscribe, e-mail: beginners-unsubs
On Jul 17, 2010, at 10:01, "Dr.Ruud" wrote:
> Vishal Gupta wrote:
> > Sharan asked:
>
> >> my @table = @{ $tableRef };
> >>
>>> 2) what does @table contain?
>> @table will contains the original array, which is referenced by "$tableRef".
>
> Be more careful: it contains a copy.
snip
More spec
Vishal Gupta wrote:
> Sharan asked:
>> my @table = @{ $tableRef };
>>
2) what does @table contain?
@table will contains the original array, which is referenced by "$tableRef".
Be more careful: it contains a copy.
--
Ruud
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additio
On Fri, Jul 16, 2010 at 10:18, Shawn H Corey wrote:
> On 10-07-16 08:17 AM, Chas. Owens wrote:
>>
>> So it can get bad:
>>
>> my $ref = \\[1];
>> print @$$$ref, "\n";
snip
> If you have something that complicated, it's going to be bad not matter how
> you do it.
snip
Yeah, at a time like
On 10-07-16 08:17 AM, Chas. Owens wrote:
So it can get bad:
my $ref = \\[1];
print @$$$ref, "\n";
but I fail to see how
print @{${${${${${${$ref}}}, "\n";
or even worse
print @{ ${ ${ ${ ${ ${ ${ $ref } } } } } } }, "\n";
makes that any better.
If you have something that compl
On Fri, Jul 16, 2010 at 06:15, Rob Coops wrote:
snip
> Yes it is the same but for readability reasons is better to use the @{}
> solution. Think about a complex structure you could get something like
> @%$variable which looks more like you are cursing cartoon style
> then writing code certainly if
On Fri, Jul 16, 2010 at 12:06 PM, Sharan Basappa
wrote:
> Thanks, Vishal.
>
> I was confused with usage {}. So you are saying that it will
> dereference the array.
> Isn't @$tableRef not enough in that case?
>
> Regards,
> Sharan
>
>
> On Fri, Jul 16, 2010 at 3:33 PM, Vishal Gupta
> wrote:
> > Hi
Ya Sharan,
@$tableRef is also enough in this case. But as we know, there are many ways to
do a single job in Perl... so we can use either ways also.
Regards,
Vishal
> Date: Fri, 16 Jul 2010 15:36:25 +0530
> Subject: Re: need explanation
> From: sharan.basa...@gmail.com
> To:
Sharan Basappa wrote:
Folks,
Hello,
I am putting a line of code which I am not able to clearly understand.
This is a reuse ...
my(@table) = @{$tableRef};
The tableRef is returned as a reference after reading a file that
contains record.
Two questions:
1) what does @{$tableRef} really do?
Thanks, Vishal.
I was confused with usage {}. So you are saying that it will
dereference the array.
Isn't @$tableRef not enough in that case?
Regards,
Sharan
On Fri, Jul 16, 2010 at 3:33 PM, Vishal Gupta
wrote:
> Hi Sharan,
>
> Please find below the answers:
>
> 1) what does @{$tableRef} reall
Hi Sharan,
Please find below the answers:
1) what does @{$tableRef} really do?
This will de-reference the "$tableRef", which is suppose to be an array
reference.
2) what does @table contain?
@table will contains the original array, which is referenced by "$tableRef".
Regards,
Vishal
Folks,
I am putting a line of code which I am not able to clearly understand.
This is a reuse ...
my(@table) = @{$tableRef};
The tableRef is returned as a reference after reading a file that
contains record.
Two questions:
1) what does @{$tableRef} really do?
2) what does @table contain?
Regard
Thanks Rob, Jim and all others who helped me in explaining this code.
On Fri, Oct 9, 2009 at 1:06 PM, Rob Coops wrote:
>
>
> On Fri, Oct 9, 2009 at 9:58 AM, Raheel Hassan wrote:
>
>> Thanks Jim for a nice reply, could you explain what
>> push(@$temp_table,$ref->[$i]); is doing. in the first code
On Fri, Oct 9, 2009 at 9:58 AM, Raheel Hassan wrote:
> Thanks Jim for a nice reply, could you explain what
> push(@$temp_table,$ref->[$i]); is doing. in the first code.
>
> In the second @_= $dbh where as in the if command $_ is getting the values
> from this default array. Then how it can return
Thanks Jim for a nice reply, could you explain what
push(@$temp_table,$ref->[$i]); is doing. in the first code.
In the second @_= $dbh where as in the if command $_ is getting the values
from this default array. Then how it can return \%s..in the last
statement.
On Thu, Oct 8, 2009 at 6
Raheel Hassan wrote:
Hello,
Hello,
I have problems in understanding $...@$ use ?
1- my $ref = $$temp_sth -> fetchall_arrayref({});
for(my $i=0; $i <= $...@$ref}; $i++) {
push(@$temp_table,$ref->[$i]);}
$...@$ref} should be $#{$ref} or simply $#$ref
And
for(my $i=0; $i <= $...
On 10/8/09 Thu Oct 8, 2009 9:00 AM, "Raheel Hassan"
scribbled:
> Hello,
>
> I have problems in understanding $...@$ use ?
>
> 1- my $ref = $$temp_sth -> fetchall_arrayref({});
> for(my $i=0; $i <= $...@$ref}; $i++) {
For any array @a, the largest index is given by $#a.
$ref is a ref
Hello,
I have problems in understanding $...@$ use ?
1- my $ref = $$temp_sth -> fetchall_arrayref({});
for(my $i=0; $i <= $...@$ref}; $i++) {
push(@$temp_table,$ref->[$i]);}
Can some one explain the under given function.
2- sub buildSensorsHashtable
{
my ($dbh) = @_;
my $e
32 matches
Mail list logo