200
> Marco wrote:
>
> > Hello.
> >
> > I need some help in understanding why the first
> >
> > my ($Count,$Saw)=$self->{_Portobj}->read(1);
> >
> > is executed without any problem , however the second identical statement
> > inside the while
Hi Marco,
see below for my response.
On Thu, 18 Jun 2015 15:17:27 +0200
Marco wrote:
> Hello.
>
> I need some help in understanding why the first
>
> my ($Count,$Saw)=$self->{_Portobj}->read(1);
>
> is executed without any problem , however the second ident
Hello.
I need some help in understanding why the first
my ($Count,$Saw)=$self->{_Portobj}->read(1);
is executed without any problem , however the second identical statement
inside the while loop fails with the error
Can't call method "read" on an undefined value
On Thu, May 21, 2015 at 3:41 AM, Vincent Lequertier wrote:
> From http://perldoc.perl.org/perlmod.html#Perl-Modules, "1;" is used to end
> with a true value
There is a bit better explanation here:
http://www.perlmonks.org/?node_id=781340
In short, `use' is like syntactic sugar around `require'
From http://perldoc.perl.org/perlmod.html#Perl-Modules, "1;" is used to
end with a true value
---
Vincent Lequertier
s...@riseup.net
Le 2015-05-21 08:13, Sunita Pradhan a écrit :
Hi
Why a perl programmer use 1 or any number as last statement in module
or package (like : 1;)?I check
When a module is loaded (via use) the compiler will complain unless the
last statement executed when it is loaded is true. This line ensures that
this is the case (as long as you don't place any code after this line).
Perl's way of making sure that it successfully parsed all the way to
As Per my Understanding...
The last line file must contain the line with the 1; statement. As This in
effect returns a true value to the program using the module. if you are Not
using the 1; statement it will not let the module be loaded correctly.
On Thu, May 21, 2015 at 11:43 AM, Sunita
Hi
Why a perl programmer use 1 or any number as last statement in module or
package (like : 1;)?I checked without that also package gets loaded .
Can somebody please explain properly , it would be good with examples ?
ThanksSunita
I correct in thinking that Perl
evaluates an inline 'if' from right to left - meaning that if
$item->{optionprice} is NOT true, then the addition will not even be
seen? Or does Perl look at the entire line before performing it?
I'm not clear what you mean by an *inline* i
On Sep 17, 2014, at 3:32 PM, Rob Dixon wrote:
> As you have presented them, those code fragments are identical in meaning.
That was my understanding as well, but the inline 'if' gave an error
while the block didn't. Running the code by itself in TextWrangler does not
produce the warning
->{'unitprice'} += $item->{'optionprice'} if ($item->{'optionprice'});
Given the following values:
$item->{'unitprice'} = '12.16';
$item->{'optionprice'} = '';
the 2nd statement returns an "Argumen
On 09/17/2014 12:46 PM, SSC_perl wrote:
> On Sep 16, 2014, at 6:58 PM,
> wrote:
>> Are you sure you've quoted the code (that's producing the warning) correctly?
>
> Yes, I did. I double-checked it just to be certain. However, I ran
> the code by itself and it doesn't produce that warni
On Sep 16, 2014, at 6:58 PM,
wrote:
> Are you sure you've quoted the code (that's producing the warning) correctly?
Yes, I did. I double-checked it just to be certain. However, I ran
the code by itself and it doesn't produce that warning, so it must be something
upstream that's caus
-Original Message-
From: SSC_perl
Sent: Wednesday, September 17, 2014 10:37 AM
To: Perl Beginners
Subject: Argument isn't numeric warning in if statement
I just ran across something puzzling. Why are these two statements not
equivalent when it comes to warnings?
if (
} += $item->{'optionprice'} if ($item->{'optionprice'});
Given the following values:
$item->{'unitprice'} = '12.16';
$item->{'optionprice'} = '';
the 2nd statement returns an "Argument '' isn
2013/8/15 Brian Fraser :
> On Wed, Aug 14, 2013 at 6:09 PM, Alexey Mishustin
>> I'm sorry only that there is no built-in option with which one could
>> enable/disable easily assignments inside `if'. (E.g., like re 'eval'/
>> no re 'eval'). It would "provide choices"...
>>
>
> It might not be too
igning it - I have never done this at the same
> >>> time...
> >>
> >>
> >>
> >> Doing both in while statements is very common:
> >>
> >>while( my $line = <$fh> ) {
> >> ...
> >>}
> >>
gt; Doing both in while statements is very common:
>>
>>while( my $line = <$fh> ) {
>> ...
>>}
>>
>> Try to write that loop with two separate statements, one an
>> assignment
>
> and the other an if statement, and you may see the
t loop with two separate statements, one an
assignment
and the other an if statement, and you may see the advantage of the
currently-allowed syntax.
The general policy is that assignment statements return a value that
may be further used or tested.
i have a common idiom when dealing with a
s, one an assignment and the
other an if statement, and you may see the advantage of the currently-allowed
syntax.
The general policy is that assignment statements return a value that may be
further used or tested.
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional command
Thanks to all,
2013/8/14 Jim Gibson :
> The problem is that the construct
>
> if( $foo = $bar ) {
> ...
>
> is not always a typo. It means: "assign value of $bar to variable $foo and
> test if the result is logically true", which is perfectly valid. If that were
> not allowed, then you wo
Or maybe he can write a perl script to check the "if/while" conditionals of his
perl script...
while(<>){
say '= is detected where == is expected at line ',"$." if
/if\s*\(\S+?=[^=]/;
}
On 15 Aug 2013, at 03:02, Rob Dixon wrote:
> On 14/08/2013 18:21, Alexey Mishustin wrote:
>>
>> If
Hi Alex,
I guess it would be very difficult and error-prone to do it. Here's my thought:
my $bar = 3;
my $assign = (my $foo = $bar);
if($assign){
say '$assign=',$assign;
}
my $equal = ($foo == $bar);
if($equal){
say '$equal=',$equal;
}
output:
$ perl tst.pl
$assign=3
$equal=1
But if $
On 14/08/2013 18:21, Alexey Mishustin wrote:
If I make a typo and write a single "equals" operator here:
if ($foo = 2) {
print "yes\n";
}
...then the "warnings" pragma works OK and tells me "Found = in
conditional, should be ==..."
But if I make the same typo and write a single "equal
On Aug 14, 2013, at 11:34 AM, Alexey Mishustin wrote:
> Hi Jing,
>
> Thanks for the reply.
>
> So, there is no built-in way to catch these typos?
The problem is that the construct
if( $foo = $bar ) {
...
is not always a typo. It means: "assign value of $bar to variable $foo and test
i
Hi Jing,
Thanks for the reply.
So, there is no built-in way to catch these typos?
--
Regards,
Alex
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/
Hi there,
Allow me to correct myself, the value of the assignment is the new value of the
variable. But in the end it is the same. The compiler won't be able to see what
$bar is when used in if ($foo=$bar), therefore won't throw any warnings.
Cheers,
Jing
On 15 Aug 2013, at 01:21, Alexey Mishus
Hi Alexey,
If I remember correctly, when you assign a value to an lvalue like this:
$foo = 1;
The value of the assignment is the value on the right hand side of the equal
sign.
So when you do something like:
if ($foo=2){...}
It has the same effect as this:
$foo=2;
If (2){...}
The condition
Hello all,
If I make a typo and write a single "equals" operator here:
#!/usr/bin/perl
use strict;
use warnings;
my $foo = 1;
my $bar = 2;
if ($foo = 2) {
print "yes\n";
}
else {
print "no\n";
}
...then the "warnings" pragma works OK and tells me "Found = in
conditional, shoul
Thanks for everybody assistance, found a an appropiate solution to my problem.
Without having to use the case statement.
Cheers
Paul
From: Hal Wigoda
To: beginners@perl.org
Sent: Thursday, 2 August 2012 5:38 AM
Subject: Re: case statement in perl
so why
I have removed the switch funtion from the script.
From: Uri Guttman
To: beginners@perl.org
Sent: Thursday, 2 August 2012 2:02 AM
Subject: Re: case statement in perl
On 08/01/2012 03:08 AM, Paul.G wrote:
> The example below is just a test, I need to be a
On Wed, Aug 01, 2012 at 14:38:42 -0500 , Hal Wigoda wrote:
> so why don't they get rid of it?
I'm not sure which "it" you're referring to: Switch.pm or given/when.
For better or worse, Perl has a strong culture of backwards
compatibility. Perl is one of the few languages where you can use code
wr
the downside of that nasty hard to find bug is never
>> worth it even if switch.pm appeals to you. modern perl's have a
>> builtin given/when statement, you can use dispatch tables (especially
>> for a fixed list of numbers or tokens) and other methods too. just
>> av
m to work now and if you do some changes to your code (not even
> near the switch stuff), it could break and you will have a hell of a
> time fixing it. the downside of that nasty hard to find bug is never
> worth it even if switch.pm appeals to you. modern perl's have a
> builtin given
of a time fixing it. the
downside of that nasty hard to find bug is never worth it even if
switch.pm appeals to you. modern perl's have a builtin given/when
statement, you can use dispatch tables (especially for a fixed list of
numbers or tokens) and other methods too. just avoid using
Paul.G wrote:
The example below is just a test, I need to be able to insert multiple values
into a command, those values can be either 1, 2 or upto 5.
Below is closer to the working example, but I will read that document and to
help make a final decision.
# Check Free PV's
operation_CHECKFREE
]");
> }
>}
># lvsync
>run("/usr/sbin/lvsync -T $sourcelv");
>logprint "Successful $NEWMIRROR mirrors \t\t synced";
> }
> else {
>cleanexit (10, "FAIL \t\t No Free PV's Available");
> }
>
> return 0;
> }
&g
t\t synced";
}
else {
cleanexit (10, "FAIL \t\t No Free PV's Available");
}
return 0;
}
____
From: John W. Krahn
To: Perl Beginners
Sent: Wednesday, 1 August 2012 4:58 PM
Subject: Re: case statement in perl
Paul.G wrote:
> Below is an extract from the perl
Paul.G wrote:
Below is an extract from the perl script, the switch/case statement seemed like
a simple solution.
# Mail Program #
operation_CHECKFREEPVS();
print "$numPV \n";
# print "$FreePV[1] $FreePV[0] $numPV\n&qu
Hi,
On Wed, Aug 1, 2012 at 6:18 AM, Paul.G wrote:
> Below is an extract from the perl script, the switch/case statement seemed
> like a simple solution.
>
> from perldoc -q switch <== reads and I quote
"...Starting from Perl 5.8, a source filter module, Switch,
Below is an extract from the perl script, the switch/case statement seemed like
a simple solution.
# Mail Program #
operation_CHECKFREEPVS();
print "$numPV \n";
# print "$FreePV[1] $FreePV[0] $numPV\n";
if ($numP
On Tue, Jul 31, 2012 at 23:47:45 -0500 , Hal Wigoda wrote:
> Use the switch/case combination.
>
> On Tue, Jul 31, 2012 at 11:41 PM, Paul.G wrote:
> > Hi All
> >
> >
> > Does perl have a case statement or an equivalent?
> >
> >
> > Cheers
>
Use the switch/case combination.
On Tue, Jul 31, 2012 at 11:41 PM, Paul.G wrote:
> Hi All
>
>
> Does perl have a case statement or an equivalent?
>
>
> Cheers
>
> Paul
--
-
Chicago
Hal Wigoda
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.
Hi All
Does perl have a case statement or an equivalent?
Cheers
Paul
On Apr 28, 2012, Shawn H Corey wrote:
> Moral of the story: use meaningful variable names.
Yep, you're right. =:\ I thought it was going to be a simple question
about the unless statement. Turns out I was headed down the wrong path, so I
changed the variable name to make
On 04/28/2012 01:28 PM, Shawn H Corey wrote:
On 12-04-28 12:36 PM, Uri Guttman wrote:
that reduces to just:
my $host = $mail_field || 'localhost' ;
which is the classic defaulting style. it has one flaw, it makes '' and
0 not allowed for values in $mail_field. but i doubt those would ever be
g
On 12-04-28 12:36 PM, Uri Guttman wrote:
that reduces to just:
my $host = $mail_field || 'localhost' ;
which is the classic defaulting style. it has one flaw, it makes '' and
0 not allowed for values in $mail_field. but i doubt those would ever be
good host names so it should be fine here. you
On 04/28/2012 12:10 PM, Jim Gibson wrote:
On Apr 28, 2012, at 9:04 AM, sono...@fannullone.us wrote:
my $host = 'localhost';
if ( defined ($mail_field) and ($mail_field ne '') ) {
$host = $mail_field;
}
I would use:
my $host = $mail_field ? $mail_field : 'localhost' ;
that reduces
On Sat, Apr 28, 2012 at 12:16:57PM -0400, Shawn H Corey wrote:
> On 12-04-28 12:10 PM, Jim Gibson wrote:
>>
>> On Apr 28, 2012, at 9:04 AM, sono...@fannullone.us wrote:
>>
>>> my $host = 'localhost';
>>>
>>> if ( defined ($mail_field) and ($mail_field ne '') ) {
>>> $host = $mail_field;
>>> }
>
On 12-04-28 12:10 PM, Jim Gibson wrote:
On Apr 28, 2012, at 9:04 AM, sono...@fannullone.us wrote:
my $host = 'localhost';
if ( defined ($mail_field) and ($mail_field ne '') ) {
$host = $mail_field;
}
I would use:
my $host = $mail_field ? $mail_field : 'localhost' ;
Well, since
On Apr 28, 2012, at 9:04 AM, sono...@fannullone.us wrote:
> my $host = 'localhost';
>
> if ( defined ($mail_field) and ($mail_field ne '') ) {
> $host = $mail_field;
> }
I would use:
my $host = $mail_field ? $mail_field : 'localhost' ;
--
To unsubscribe, e-mail: beginners-unsubscr...@
On Apr 28, 2012, Lesley Binks wrote:
> To be robust, you might need to check that $xtra is defined AND has something
> sensible in it using a regexp.
Well, after being set straight to the error of my ways, I finally have
code that seems to work in any situation:
my $mail_field; # set
On Sat, Apr 28, 2012 at 08:00:09AM -0700, sono...@fannullone.us wrote:
> Shawn,
>
> > are you sure this is what you want?
>
> I'm not sure of anything anymore. ;)
>
> I found something that sets $host properly:
>
> my $xtra = 'mail.example.com';
> my $host = 'localhost';
>
That's a
efined as 'mail.example.com' so $host won't be.
>
> That makes sense. What I'm trying to do is set $host to one of the two
> values - if $xtra is set, use it; if not, use localhost. I was just trying
> to get it as short as possible. Maybe I'll go back to
but I
was just trying for a one-liner. ;)
It's a bad idea to declare variables with a trailing conditional
statement
modifier (such as "if COND();" or "unless COND();").
Why is it a bad idea? Can you point me to something to read about this?
My Google searches ha
Shawn,
> are you sure this is what you want?
I'm not sure of anything anymore. ;)
I found something that sets $host properly:
my $xtra = 'mail.example.com';
my $host = 'localhost';
$host = $xtra if (length $xtra > 0);
Can anyone see any holes in this code?
Marc
--
On 12-04-28 10:16 AM, sono...@fannullone.us wrote:
I'm having a problem with the following code:
#!/usr/bin/perl
use strict;
use warnings;
my $xtra = 'mail.example.com';
my $host = 'localhost' unless (defined ($xtra));
# this is the same as saying:
my $xtra = 'mail.example.com';
my
Shlomi,
> It's a bad idea to declare variables with a trailing conditional statement
Never mind my "why" question. It finally dawned on me that the unless
statement will not set the $host variable. And I thought sleeping on it would
help. :\
Marc
--
To unsubscribe,
x27;m trying to do is set $host to one of the two
values - if $xtra is set, use it; if not, use localhost. I was just trying to
get it as short as possible. Maybe I'll go back to the if statement I had
before.
Thanks,
Marc
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For ad
trying for a one-liner. ;)
> It's a bad idea to declare variables with a trailing conditional statement
> modifier (such as "if COND();" or "unless COND();").
Why is it a bad idea? Can you point me to something to read about
this? My Google searches ha
On Sat, Apr 28, 2012 at 07:16:18AM -0700, sono...@fannullone.us wrote:
> I'm having a problem with the following code:
>
> #!/usr/bin/perl
> use strict;
> use warnings;
>
> my $xtra = 'mail.example.com';
>
> my $host = 'localhost' unless (defined ($xtra));
>
> print $host;
>
> I ge
On 04/28/2012 09:16 AM, sono...@fannullone.us wrote:
I'm having a problem with the following code:
#!/usr/bin/perl
use strict;
use warnings;
my $xtra = 'mail.example.com';
my $host = 'localhost' unless (defined ($xtra));
print $host;
I get the message "Use of uninitialized va
27; unless (defined ($xtra));
>
It's a bad idea to declare variables with a trailing conditional statement
modifier (such as "if COND();" or "unless COND();").
What you should do is:
[CODE]
my $host;
unless (defined($xtra))
{
$host = 'localhost';
}
[
I'm having a problem with the following code:
#!/usr/bin/perl
use strict;
use warnings;
my $xtra = 'mail.example.com';
my $host = 'localhost' unless (defined ($xtra));
print $host;
I get the message "Use of uninitialized value $host in print". Does
anyone know why this doesn'
On 12-03-14 12:35 AM, John W. Krahn wrote:
cmp is a binary operator just like eq, ne, gt, lt, ge and le.
See `perldoc perlop` and search for /Equality Operators/
--
Just my 0.0002 million dollars worth,
Shawn
Programming is as much about organization and communication
as it is about co
Noah wrote:
Hi there,
Hello,
I am trying to get two conditions matched
how can I get if ( ($source_location eq $destination_location ) && (
$source_device < $destination_device ) ) {
That should be:
if ( $source_location eq $destination_location && $source_device lt
$destination_device )
Hi there,
I am trying to get two conditions matched
how can I get if ( ($source_location eq
$destination_location ) && ( $source_device < $destination_device ) ) {
and
if ( ($source_location eq $destination_location ) && (
$source_device > $destination_device ) ) {
On Wed, Mar 23, 2011 at 08:47, Sudhir wrote:
> My work environment recently shifted from perl v5.6 to perl v5.10
>
> I found one issue with perl format statement in latest version v5.10
>
> sample code:
>
> #!/bin/env perl
> use strict;
>
> &genRep();
>
&
My work environment recently shifted from perl v5.6 to perl v5.10
I found one issue with perl format statement in latest version v5.10
sample code:
#!/bin/env perl
use strict;
&genRep();
sub genRep
{
format DURATION_TOP =
@<<<<<<<<<
On 2010-12-26 18:28, Brian Fraser wrote:
> Your example actually works -- On perl 5.13.+:
> http://www.effectiveperlprogramming.com/blog/683
that's good news (even though it means I'll have to wait
a little longer until I can actually use it) - at least I'm
obviously not the only one who felt, tha
On Sun, Dec 26, 2010 at 06:13:06PM +0100, Peter Daum wrote:
> Is it possible to get a value from a given-when statement?
>
> Suppose I have a long comparison in which all branches affect
> the same variable. Here's a short example (minor variation
> from"perlsyn
Your example actually works -- On perl 5.13.+:
http://www.effectiveperlprogramming.com/blog/683
Brian.
Is it possible to get a value from a given-when statement?
Suppose I have a long comparison in which all branches affect
the same variable. Here's a short example (minor variation
from"perlsyn"):
given($something) {
when (/^abc/) { $x = 1; }
when (/^def/) { $x = 2; }
On Monday 20 September 2010 12:30:55 Raj wrote:
> Hi,
>
> I am a newbie for perl.
>
> It would be fine if some explain how the following code prints first
> 10 lines of the file.
> My question here is, how/what if condition match happens? Is there
> anything related to current record number ($.
Hi,
I am a newbie for perl.
It would be fine if some explain how the following code prints first
10 lines of the file.
My question here is, how/what if condition match happens? Is there
anything related to current record number ($.) variable?
while () {
print if 1 .. 10;
}
Regards,
Raj
On Thu, Aug 5, 2010 at 00:16, HACKER Nora wrote:
> Hi,
>
> Additional noob question: What would be wrong with
>
> $version = '0'.$version;
snip
Do you always want one 0 in front of version? What if the version is
9? Shouldn't it be "009" then? You could write:
#version should be th
Betreff: Re: Is this perl statement valid?
>
> On 10-08-04 05:39 AM, Sooraj S wrote:
> > Hi,
> >
> > My code is accepting an option "version" as an integer. If it is
> less
> > than 100, i need to add a zero in front of it so that i can do the
> > fur
Mornin' Sooraj,
As is true of most "does this work in Perl" questions, the answer is "Try it" --
C:\Documents and Settings\Administrator>perl -e
"$version=9;$version=sprintf(\"0%d\",$version); print $version; "
09
C:\Documents and Settings\Administrator>
Enjoy ---
B
On Wed, Aug 4, 2010 at 4:5
On 10-08-04 05:39 AM, Sooraj S wrote:
Hi,
My code is accepting an option "version" as an integer. If it is less
than 100, i need to add a zero in front of it so that i can do the
further processing.
Although this code is working, i am not sure that its the proper way.
if ($version< 100)
{
Hi,
My code is accepting an option "version" as an integer. If it is less
than 100, i need to add a zero in front of it so that i can do the
further processing.
Although this code is working, i am not sure that its the proper way.
if ($version < 100)
{
# convert an integer-variable to string
>>>>> "TB" == Thomas Bätzler writes:
TB> You can do something like
TB> my $cond = eval( $statement );
TB> The two important things to keep in mind:
TB> 1) Make sure you sanitize $statement very carefully. Otherwise people can
run arbitrary perl
sillymonkeysoftw...@gmail.com asked:
> I'm working with some customizable data from a config file, and can't
> for the life of me figure out how to test conditionals from an
> external source.
> Does anyone have an idea how to accomplish something like:
>
> m
f me figure out how to test conditionals from an
>> external source.
>> Does anyone have an idea how to accomplish something like:
>>
>> my $statement = "1 < 10 and 2 > 10"; # obviously false
>> my $result = ($statement) ? 1 : 0;# condit
ve an idea how to accomplish something like:
>
> my $statement = "1 < 10 and 2 > 10"; # obviously false
> my $result = ($statement) ? 1 : 0;# conditional test
>
> Now, $result will always be true(1), because the conditional is
> really, in effect, just val
> Does anyone have an idea how to accomplish something like:
sc> my $statement = "1 < 10 and 2 > 10"; # obviously false
sc> my $result = ($statement) ? 1 : 0; # conditional test
that will never work as is. perl doesn't interpret $statement as
code. if
Hi everyone,
I'm working with some customizable data from a config file, and can't
for the life of me figure out how to test conditionals from an
external source.
Does anyone have an idea how to accomplish something like:
my $statement = "1 < 10 and 2 > 10"; # obvi
> "OR" == Octavian Rasnita writes:
OR> From: "Uri Guttman"
>>
>> it isn't religious. it is just no one is taught the right way
>> anymore. it used to be always done this way (in the good very old
>> day). with the onslaught of redmond and aol the unwashed masses didn't
>> learn
From: "Uri Guttman"
> MC> Uri: I think the quoting is much a religious issue as everyone has their
> MC> preferred way, but I now know what you meant. :-)
>
> it isn't religious. it is just no one is taught the right way
> anymore. it used to be always done this way (in the good very old
> day)
> "MC" == Mimi Cafe writes:
MC> Earlier I thought of using an eval or BEGIN block to evaluate the
MC> SQL, but then I thought wait a minute, that wouldn't be the
MC> correct way of using them. Now I see that doing as you guys
MC> recommended is the right way forward.
a BEGIN block ma
>> -Original Message-
>> I'm talking for myself here, but the way I usually do this is that I wrap
>> up each SQL query or set of related SQL queries in a subroutine.
>>
>> If the sub's going to be used as a predicate I make sure it returns
>> true/false and pass all of the relevant data
Mimi Cafe asked:
> I need to evaluate a statement in an if, elsif, else block, and the
> statement to evaluate in the elsif is too large as I need to run a SQL
> query and act on the return value.
> What would be a better way to achieve this? Putting the SQL statement
> elsewh
>>>>> "MC" == Mimi Cafe writes:
MC> I need to evaluate a statement in an if, elsif, else block, and
MC> the statement to evaluate in the elsif is too large as I need to
MC> run a SQL query and act on the return value. What would be a
MC> better
I need to evaluate a statement in an if, elsif, else block, and the
statement to evaluate in the elsif is too large as I need to run a SQL query
and act on the return value.
What would be a better way to achieve this? Putting the SQL statement
elsewhere outside the block cannot be right, so I am
.
Thanks
Soham
- Original Message
From: Uri Guttman
To: Soham Das
Cc: beginners@perl.org
Sent: Thursday, 16 July, 2009 11:30:31 AM
Subject: Re: Fw: Modifiers on the right side of the statement
>>>>> "SD" == Soham Das writes:
SD> - Forwarded Messag
On Wed, Jul 15, 2009 at 19:19, Steve Bertrand wrote:
> Hi all,
>
> While writing some tests, I ran into something that took me quite a
> while to troubleshoot. Although I figured out the problem, I don't
> understand why the problem is occurring.
>
> Can someone point out the importance of the brac
>>>>> "SD" == Soham Das writes:
SD> - Forwarded Message
SD> From: Soham Das
SD> To: Uri Guttman
SD> Sent: Thursday, 16 July, 2009 11:23:29 AM
SD> Subject: Re: Modifiers on the right side of the statement
SD> I believe its beca
- Forwarded Message
From: Soham Das
To: Uri Guttman
Sent: Thursday, 16 July, 2009 11:23:29 AM
Subject: Re: Modifiers on the right side of the statement
I believe its because =~ has the highest priorty...
- Original Message
From: Uri Guttman
To: John W. Krahn
Cc
Uri Guttman wrote:
"JWK" == John W Krahn writes:
>>> Can someone point out the importance of the brackets in which '2'
>>> prints, but '1' does not? I've always thought that the brackets could be
>>> omitted:
>>>
>>> print "1" if ref $href =~ /HASH/;
>>> print "2" if ref($href)
Uri Guttman wrote:
> you need to wrap the call in block eval and check for die
> afterwards. see perldoc -f eval and perlvar for $...@. note that this is
> BLOCK eval which is fine to use anywhere you want to trap dies and not
> string eval which is evil unless absolutely necessary.
>
> SB> is
etter test
> and the op is faster and binds better.
Ok.
> SB> I don't want to change the object method's behaviour just for a test, so
> SB> can anyone point me in the right direction as to how I can override the
> SB> object method's needed die() statemen
1 - 100 of 508 matches
Mail list logo