Mike:
On Thu, Jun 25, 2015 at 5:42 AM, Mike Martin wrote:
> Hi
> I am currently getting issues with regexes that use the qr operator.
>
> The results with qr are different than without. This is a small sample
> program to illustrate it
>
> use strict;
>
> my $str=
Hi
I am currently getting issues with regexes that use the qr operator.
The results with qr are different than without. This is a small sample
program to illustrate it
use strict;
my $str='Database Administrator';
my $pattern=
'(?=^(?:(?!(?:datab|network|system)).)*$).*(?:Adm
Hi Adam,
Yes File is RTF.
Regards,
Jitendra
On Fri, Dec 5, 2014 at 7:57 PM, Adam Millerchip wrote:
> Your filename is in a variable called $rtf1, is the file an RTF?
>
> Maybe something funny is going on with the file-format/encoding, and the
> first line doesn't contain %VERSION% when parsed
Your filename is in a variable called $rtf1, is the file an RTF?
Maybe something funny is going on with the file-format/encoding, and the
first line doesn't contain %VERSION% when parsed by your script. You could
try printing out the line in your script to see what it's trying to match:
for(@arra
Hi Shawn,
it is VERSION. This is the not a issue. s/\%VERSION\%/$version1/g; the
correct one.
If I changed VERSION to VERSIONABC it is working correctly OR if I add more
character to VERSION then it is working. I could not understand why it is
not working for me.
The first place in the file is n
On Thu, 4 Dec 2014 16:06:26 +0530
Jitendra Barik wrote:
> My code is:
>
> $version1 = "JITENDRA";
> tie @array,Tie::File,"$rtf1" or die($!);
>
> for(@array){
> #print "Hi";
> s/\%VERSIONS\%/$version1/g;
>
>
> }
> untie(@array);
>
> FILE:
> ***
Hello,
I am sorry, I don't know what are you doing wrong, but this
code works for me.
use strict;
#use warnings;
use Tie::File;
my $file
= 'file.txt';
my $version1 = "JITENDRA";
tie my(@array), 'Tie::File',
$file or die "Cannot open file `$file': $!";
for(@array) {
#warn "F: ",
$_;
s/%VER
HI All,
My code is:
$version1 = "JITENDRA";
tie @array,Tie::File,"$rtf1" or die($!);
for(@array){
#print "Hi";
s/\%VERSIONS\%/$version1/g;
}
untie(@array);
FILE:
***
*Version *%VERSION%, Hello,HI
*Installation Notes*
T
uld be to add the number
value of each character. This would fullfill
H(string1 . string2) = H(string1) + H(string2)
I am not sure if the modulo operator also fulfils
(a % b) % c = (a % c) % (b % c)
In that case you could also use the modulo on your hash function.
>
> strin
On 09/25/13 18:53, Jing Yu wrote:
Another look at it, and I think I've pointed you to a wrong way. BLAST might
not what you need. Sorry about this.
No problem. The more I look at it, the less I believe there is such a
pair of functions.
David
--
To unsubscribe, e-mail: beginners-unsubscr
Hi David,
Another look at it, and I think I've pointed you to a wrong way. BLAST might
not what you need. Sorry about this.
Jing
On 25 Sep 2013, at 03:31, David Christensen wrote:
> On 09/24/13 00:12, Dr.Ruud wrote:
>> I assume this is about paths and filenames. Have you considered an rsync
>>
On 09/24/13 00:12, Dr.Ruud wrote:
I assume this is about paths and filenames. Have you considered an rsync
dry-run?
I use "rsync -n ..." frequently.
I also assume that you want to communicate as little as possible, so you
don't have supersets of all strings on all sides. (or it would become
On 24/09/2013 00:17, David Christensen wrote:
I'm looking for a hash function and a related function or operator such
that:
H(string1 . string2) = f(H(string1), H(string2))
H(string1 . string2) = H(string1) op H(string2)
where:
H() is the hash function
st
On 09/23/13 18:17, Jing Yu wrote:
I don't know the answer but... it sounds like NCBI's BLAST to me, which
compares nucleotide or protein sequences. NCBI's FTP site provides local BLAST
binaries, and bioperl offers some convenient tools to implement it.
That looks like server-side software, ca
Hi David,
I don't know the answer but... it sounds like NCBI's BLAST to me, which
compares nucleotide or protein sequences. NCBI's FTP site provides local BLAST
binaries, and bioperl offers some convenient tools to implement it.
Regards,
Jing
On 24 Sep 2013, at 07:01, David Christensen wrote
On 09/23/13 15:34, someone wrote:
Er "hash function" as in crypto hashing? a does:
H(string1 . string2) = f(H(string1), H(string2))
H(string1 . string2) = H(string1) op H(string2)
mean that
I'm looking for a hash function and a related function or operator such
that
On 09/23/13 15:29, Rob Dixon wrote:
My immediate thought is that the only hash function that can work like
this is the identity function (or any one-one mapping) because, by
extension, the hash of a string must be equal to f(the hash of each of
its characters).
Not that I can prove this at presen
On 23/09/2013 23:17, David Christensen wrote:
beginners:
I'm looking for a hash function and a related function or operator such
that:
H(string1 . string2) = f(H(string1), H(string2))
H(string1 . string2) = H(string1) op H(string2)
Hi David
My immediate thought is that the
beginners:
I'm looking for a hash function and a related function or operator such
that:
H(string1 . string2) = f(H(string1), H(string2))
H(string1 . string2) = H(string1) op H(string2)
where:
H() is the hash function
string1 is a string
st
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
On Wed, Aug 14, 2013 at 6:09 PM, Alexey Mishustin wrote:
> 2013/8/15 Uri Guttman :
> > On 08/14/2013 04:22 PM, Jim Gibson wrote:
> >>
> >>
> >> On Aug 14, 2013, at 12:30 PM, Alexey Mishustin wrote:
> >>
> >>> Testing a value and assigning it - I have never done this at the same
> >>> time...
> >>
2013/8/15 Uri Guttman :
> On 08/14/2013 04:22 PM, Jim Gibson wrote:
>>
>>
>> On Aug 14, 2013, at 12:30 PM, Alexey Mishustin wrote:
>>
>>> Testing a value and assigning it - I have never done this at the same
>>> time...
>>
>>
>>
>> Doing both in while statements is very common:
>>
>>while( my $
On 08/14/2013 04:22 PM, Jim Gibson wrote:
On Aug 14, 2013, at 12:30 PM, Alexey Mishustin wrote:
Testing a value and assigning it - I have never done this at the same time...
Doing both in while statements is very common:
while( my $line = <$fh> ) {
...
}
Try to write that loop
On Aug 14, 2013, at 12:30 PM, Alexey Mishustin wrote:
> Testing a value and assigning it - I have never done this at the same time...
Doing both in while statements is very common:
while( my $line = <$fh> ) {
...
}
Try to write that loop with two separate statements, one an assignment
able at the same time. Perl cannot know
> that the code was unintentional and will not warn you.
Testing a value and assigning it - I have never done this at the same time...
> I have checked both Perl::Critic and B::Lint, and neither of these check
> for an assignment operator in a co
8: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 "
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
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/
21, Alexey Mishustin wrote:
> 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";
&
wrote:
> 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 {
>
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
\d)?(PATTERN3)/;
> and one of the patterns is not there, still everything will be shifted to the
> right, won't it? I figured that by naming the captures, I will always know if
> there was a match at the very position intended.
If the regular expression does not match all three p
built-in variables that relate to regular expressions are modified
by every successful pattern match. It is safer to save values that you
may want to use later in a sperate variable. In particular, your regex
m/(?AVG\s\d)/ matches and, because there is no capture named `GFP`
it sets the correspondi
is safer to save values that you
may want to use later in a sperate variable. In particular, your regex
m/(?AVG\s\d)/ matches and, because there is no capture named `GFP`
it sets the corresponding element of %+ to undef. However $+{AVG} is now
set, as you did have a capture with that name.
The patt
Hi all,
I'm parsing a logfile and don't quite understand the behaviour of m//.
From a previous regex match I have already captured $+{'GFP'}:
use strict;
use warnings;
(...)
$text =~ m/ (?FILTERS .*? WRT)/x;# I simply have my whole
logfile in $text - I know there are better solutions.
On 04/07/2012 06:54 AM, Peter Scott wrote:
On Wed, 04 Apr 2012 03:04:42 -0400, Uri Guttman wrote:
that code is not a good use of ?: at all so use if/else.
Right. And if you want the single statement succinctness, use and/or:
% perl -le '%test = qw(one first two second); $test{one} eq "firs
On Wed, 04 Apr 2012 03:04:42 -0400, Uri Guttman wrote:
> On 04/03/2012 06:55 PM, timothy adigun wrote:
> that is the wrong way to fix this even if it works.
>
> the ternary operator is meant to return a single value from a choice of
> two expressions. it is not meant for si
h
>
> On Tue, 3 Apr 2012 17:39:10 -0400
> "Stan N/A" wrote:
>
>> I've run into a weird issue where the ternary operator isn't doing
>> what I believe it normally would and need some help understanding the
>> issue. I'm sure I'm missing
Shlomi Fish wrote:
Hi Cyril,
I'm CCing the list - I hope it's OK
I hate handling carbon copies, you always get that black stuff all over
your hands!
John
--
Any intelligent fool can make things bigger and
more complex... It takes a touch of genius -
and a lot of courage to move in the oppo
*
> *}*
Well, your mailer has mangled the non-HTML version of this code, but luckily I
can still read it. I don't think this is bad code because both clauses of the
ternary operators lack side-effects. People may call to func
misunderstanding.
Thanks to the original poster and all the people who replied.
Regards,
Shlomi Fish
On Tue, 3 Apr 2012 17:39:10 -0400
"Stan N/A" wrote:
> I've run into a weird issue where the ternary operator isn't doing
> what I believe it normally would and need s
On Tue, Apr 03, 2012 at 05:39:10PM -0400, Stan N/A wrote:
> I've run into a weird issue where the ternary operator isn't doing
> what I believe it normally would and need some help understanding the
> issue. I'm sure I'm missing some critical point, but perhaps this is
On 04/03/2012 06:55 PM, timothy adigun wrote:
Hi Stan,
Please check my comments below:
On Tue, Apr 3, 2012 at 10:39 PM, Stan N/A wrote:
I've run into a weird issue where the ternary operator isn't doing
what I believe it normally would and need some help understanding the
issue. I&
On 2012-04-03 18:55, timothy adigun wrote:
Hi Stan,
Please check my comments below:
$test{one} eq "first" ?
$test{one} .= " is the worst\n" :
( $test{two} .= " is the best\n");
This is not what the ternary (conditional operator) is for. As I sai
On 2012-04-03 17:39, Stan N/A wrote:
I've run into a weird issue where the ternary operator isn't doing
what I believe it normally would and need some help understanding the
issue. I'm sure I'm missing some critical point, but perhaps this is
an issue with perl. Here'
Hi Stan,
Please check my comments below:
On Tue, Apr 3, 2012 at 10:39 PM, Stan N/A wrote:
> I've run into a weird issue where the ternary operator isn't doing
> what I believe it normally would and need some help understanding the
> issue. I'm sure I'm missing som
I've run into a weird issue where the ternary operator isn't doing
what I believe it normally would and need some help understanding the
issue. I'm sure I'm missing some critical point, but perhaps this is
an issue with perl. Here's a short 14 line script exemplify
At 5:21 AM +0100 11/28/11, timothy adigun wrote:
>
> From: Owen
>
> There is no race condition.
>
> And that code demo is correct
Actually, there is in a multitasking environment. Please, check subtitle
"File Locking" in perldoc perlopentut.
masayoshi wrote:
Before calling prin
>
> > From: Owen
> >
> > There is no race condition.
> >
> > And that code demo is correct
>
Actually, there is in a multitasking environment. Please, check subtitle
"File Locking" in perldoc perlopentut.
masayoshi wrote:
> Before calling print method, the file might be deleted by another p
- Original Message -
> From: Owen
>
> There is no race condition.
>
> And that code demo is correct
>
Before calling print method, the file might be deleted by another process
So I reckoned when "File exists" appeared, the file might be deleted. >_>
---
masayoshi & Ayumi Kinoshita
> Hi,I am masayoshi.
> I read the following article.
>
> http://perltraining.com.au/tips/2005-11-24.html
>
>
> A lot of website use the following script to explain file test
> operators,
> But I reckon I should not write it for race conditions.
> Is this right?
> Thanks in advance.
>
>
> #!/usr/bi
Hi,I am masayoshi.
I read the following article.
http://perltraining.com.au/tips/2005-11-24.html
A lot of website use the following script to explain file test operators,
But I reckon I should not write it for race conditions.
Is this right?
Thanks in advance.
#!/usr/bin/perl
use strict;
use
Hi samjesse,
using a for loop to iterate the array @subjects and at each instances,
count the number of occurrence of each *member* [or element] of the array
@subjects, [ and STORE] using a hash %subjects [ which of course is
different from the array @subjects, though
the same name was used ]
Hello
>From the element of the array @subjects you create a hash table
%subjects and its keys are the element of @subject whose
their values are given by an incrementation from an undefined value
(defaut consider is 0) so 1.
Regards
A.
2011/11/24 samjesse :
> Hi
>
> what does this mean
> forea
On 24 November 2011 03:40, samjesse wrote:
> Hi
>
> what does this mean
> foreach $msg (@subjects) {
> $subjects{$msg}++;
> }
>
> thx
http://perldoc.perl.org/perlop.html#Auto-increment-and-Auto-decrement
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-m
Hi
what does this mean
foreach $msg (@subjects) {
$subjects{$msg}++;
}
thx
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/
Ubuntu 10.04 is Perl 5.10, which has this operator avaiable.
On Wed, Aug 3, 2011 at 1:59 PM, shawn wilson wrote:
> On Aug 3, 2011 12:40 AM, "Brian Fraser" wrote:
>>
>> On Wed, Aug 3, 2011 at 2:32 AM, terry peng wrote:
>>
>> > I have forgot that, is
On Aug 3, 2011 12:40 AM, "Brian Fraser" wrote:
>
> On Wed, Aug 3, 2011 at 2:32 AM, terry peng wrote:
>
> > I have forgot that, is there a //= operator in Perl?
> > which should do the same stuff as:
> >
> > unless (defined($foo) ) {
> >$foo =
On Wed, Aug 3, 2011 at 2:32 AM, terry peng wrote:
> I have forgot that, is there a //= operator in Perl?
> which should do the same stuff as:
>
> unless (defined($foo) ) {
>$foo = ...;
> }
>
> Thanks.
>
>
Yes.
Now wasn't that simple? : ) It's the de
I have forgot that, is there a //= operator in Perl?
which should do the same stuff as:
unless (defined($foo) ) {
$foo = ...;
}
Thanks.
I guess I should provide some real code.
below is a tiny module I grabbed from my project which is not that privacy
but sufficient for discussion.
#/usr/bin/perl
use warnings;
use 5.010;
use Carp;
use DB_File;
{
my %sum_cache;
my %deviation_cache;
tie %sum_cache => 'DB_File', "sum_cac
On 2011-05-27 02:27, char...@pulsenet.com wrote:
for (0 .. 6) {
Be aware that this sets up a memory structure. Still 2 times faster than
looping:
$ time perl -wle '$i=0; 1 while $i++ < 1e4'
real0m0.005s
$ time perl -wle '$i=0; 1 while $i++ < 1e5'
real0m0.013s
$ time perl -wle
> "RD" == Rob Dixon writes:
RD> On 26/05/2011 06:18, Uri Guttman wrote:
XL> for($i = 0; $i< @lines; $i++)
>>
>> first rule: don't use c style index loops when you can avoid them. that
>> line is much faster and more perlish as:
>>
>> foreach my $i ( 0 .. $#lines )
RD> It
you publish this code, which uses a slice in this way
> for my $i (99 .. 6)
> {
> my $sum;
> map {$sum += $_->{foo_value}} @lines[$i - $n + 1 .. $i];
> push @res, $sum;
> }
First of all, never use map in this way. It is a uniform list operator,
desi
On May 26, 5:44 am, jason.li...@gmail.com (Xi Liu) wrote:
> I know I am doing the repetitive and useless summing again and again. What
> confuses me is that using the same algorithm, I mean
>
> for my $i (99 .. 6)
> {
> my $sum;
> map {$sum += $_->{foo_value}} @lines[$i - $n + 1 ..
On May 25, 10:05 pm, jason.li...@gmail.com (Xi Liu) wrote:
> Hi all:
> I translated a program from c to perl.but the perl program cost 15 seconds
> compare to the original c one cost only less than 1 second, I guess this
> might be the result of I literally translated the program, using a lot of
>
OK, I think I got the idea.
I am going to change the useless code caching the result I have already
summed or inline c code to achieve a better performance. Really learned
something. Thank you!
> "XL" == Xi Liu writes:
XL> I know I am doing the repetitive and useless summing again and again. What
XL> confuses me is that using the same algorithm, I mean
XL> for my $i (99 .. 6)
XL> {
XL> my $sum;
XL> map {$sum += $_->{foo_value}} @lines[$i - $n + 1 .. $i]
I know I am doing the repetitive and useless summing again and again. What
confuses me is that using the same algorithm, I mean
for my $i (99 .. 6)
{
my $sum;
map {$sum += $_->{foo_value}} @lines[$i - $n + 1 .. $i];
push @res, $sum;
}
in perl and
for(int i =99; i <= 6;
the .. just builds a list and
internally gets the next one. the c style ++ loop has to execute several
perl operations for each iteration. a rule of thumb in perl speed (not
always true but most often it is) is the more perl code the slower. the
more you stay inside perl's guts (in c) the faste
Thanks for your help!
I am sorry I missed something important in the code snippet.
for($i = 0; $i < @lines; $i++)
{
$sum = 0;
$sum += $lines[$_]->{foo_value} for ($i - $n + 1 .. $i);
push @res, $sum;
}
this is what I intend.I try to make it clear and removed something so that
change
> "XL" == Xi Liu writes:
XL> I translated a program from c to perl.but the perl program cost 15 seconds
XL> compare to the original c one cost only less than 1 second, I guess this
XL> might be the result of I literally translated the program, using a lot of
XL> array subscripts. Afte
Hi all:
I translated a program from c to perl.but the perl program cost 15 seconds
compare to the original c one cost only less than 1 second, I guess this
might be the result of I literally translated the program, using a lot of
array subscripts. After I profile the perl program, it turned out my
Thanks, Paul. A very thoughtful response--I will try this out (I don't
recall every encountering the ?? operator, but if it works as advertised I
will likely use it a lot).
--Marc
On Thu, Apr 21, 2011 at 3:29 PM, Paul Johnson wrote:
> On Thu, Apr 21, 2011 at 01:42:42PM -0400, Marc Per
t;> This usually works fine, until I encountered an input file that did not
>> contain the string 'labelsub' after the first '' regex pattern match.
>> Then the conditional if test continued to search in the incoming lines in
>> the next file (because I am processin
tered an input file that did not
> contain the string 'labelsub' after the first '' regex pattern match.
> Then the conditional if test continued to search in the incoming lines in
> the next file (because I am processing a whole batch using the while (<>)
> operat
ontain the string 'labelsub' after the first '' regex pattern match.
> Then the conditional if test continued to search in the incoming lines in
> the next file (because I am processing a whole batch using the while (<>)
> operator), which it eventually found, and th
did not
contain the string 'labelsub' after the first '' regex pattern match.
Then the conditional if test continued to search in the incoming lines in
the next file (because I am processing a whole batch using the while (<>)
operator), which it eventually found, and then p
>>>>> "CS" == Chris Stinemetz writes:
CS> I would like to make an adjustment to this ternary operator.
CS> Instead of returning 0 if length( $dist ) is not > 1. I would like to
CS> return the last $dist value incremented by 0.1 mile so there is no g
On 3/28/11 Mon Mar 28, 2011 12:44 PM, "Chris Stinemetz"
scribbled:
> I would like to make an adjustment to this ternary operator.
> Instead of returning 0 if length( $dist ) is not > 1. I would like to
> return the last $dist value incremented by 0.1 mile so there is no
I would like to make an adjustment to this ternary operator.
Instead of returning 0 if length( $dist ) is not > 1. I would like to
return the last $dist value incremented by 0.1 mile so there is no gap
of more than 0.1 miles.
$dist = sprintf "%.1f",
( length( $dist ) > 1 ) ? $di
Jim,
Thank you for the clarification and the "perl -c yourprogram.pl" tip. It works
the way I want it to now. You have been very helpful.
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/
At 7:01 AM -0500 3/26/11, Chris Stinemetz wrote:
>
In the statement:
if( $cell )
$cell is evaluated for true or false. All scalar values are valid in this
evaluation, including numerical, string, and undef, the three types of Perl
scalar values.
On the other hand, in this statement:
:
( $cell >= 300 && $cell <= 599 && $chan == 75 ) ? 2 :
( $chan == 1025 ) ? 2 : 1
; #nested
ternary operator
$dist = sprintf "%.1f",
On 3/25/11 Fri Mar 25, 2011 1:19 PM, "Chris Stinemetz"
scribbled:
> There is no possible value of 0 for what I am trying to do. So I am
> trying to do the former example:
>
>>if( $cell ) {
You are leaving out context here, so people not familiar with this thread
will be less likely to hel
There is no possible value of 0 for what I am trying to do. So I am
trying to do the former example:
>if( $cell ) {
I am trying to code the if statement correctly, but I am getting a syntax error:
Below is how I am trying to code the if statement:
if ($cell >= 1 && $cell <= 900 ) {
On 3/25/11 Fri Mar 25, 2011 11:15 AM, "Chris Stinemetz"
scribbled:
> I am getting the warning:
>
> Argument "" isn't numeric in numeric lt (<) at ./DOband.pl line 22,
> <$fh> line 52411.
>
> It seems to be directed to the below ternary op
I am getting the warning:
Argument "" isn't numeric in numeric lt (<) at ./DOband.pl line 22,
<$fh> line 52411.
It seems to be directed to the below ternary operator:
How can I include in the ternary to ignore all non numeric values in
the elements $cell and
Chas. Owens wrote:
On Thu, Mar 24, 2011 at 16:53, Chris Stinemetz
wrote:
I have a ternary operator that I would like to be rounded to the nearest tenth
decimal
place before the array is pushed.
The proper term is conditional operator, even in C.
Rounding is a tricky subject (see
http
On Thu, Mar 24, 2011 at 16:53, Chris Stinemetz
wrote:
> I have a ternary operator that I would like to be rounded to the nearest
> tenth decimal
> place before the array is pushed.
The proper term is conditional operator, even in C.
Rounding is a tricky subject (see
http://en.wiki
On 11-03-24 04:53 PM, Chris Stinemetz wrote:
I would like the current output of my ternary operator: 2.44318181818182 to be
rounded to 2.4.
The easiest way is to use sprintf;
perl -e '$var = sprintf "%.1f", 2.44318181818182; print "$var\n";'
--
Just my 0.
I have a ternary operator that I would like to be rounded to the nearest tenth
decimal place before the array is pushed.
For example:
I would like the current output of my ternary operator: 2.44318181818182 to be
rounded to 2.4.
Below is what my code looks like:
#!/usr/bin/perl
use
On Sat, 12 Feb 2011 12:13:13 +0100, Dr.Ruud wrote:
> On 2011-02-11 11:26, Alan Haggai Alavi wrote:
>
>> $variable_1 ||= $variable_2 is equivalent to $variable_1 = $variable_1
>> || $variable_2.
>
> Hmm, I don't buy that, I would say that $x ||= $y is equivalent to
>
>$x = $y unless $x;
>
>
On 2011-02-11 11:26, Alan Haggai Alavi wrote:
$variable_1 ||= $variable_2 is equivalent to
$variable_1 = $variable_1 || $variable_2.
Hmm, I don't buy that, I would say that $x ||= $y is equivalent to
$x = $y unless $x;
alternatively:
$x or $x = $y;
because the setting of $x only needs
Hi,
> then that I don't understand is the program logic :-(
It is a logical OR. Quoting `perldoc perlop`:
C-style Logical Or
Binary "||" performs a short-circuit logical OR operation. That
is, if the left operand is true, the right operand is not even
evaluated. Scalar
Hi,
> 12$sheet -> {MaxRow} ||= $sheet -> {MinRow};
Line 12 can be written as:
$sheet->{'MaxRow'} = $sheet->{'MaxRow'} || $sheet->{'MinRow'};
For example:
$variable_1 ||= $variable_2 is equivalent to $variable_1 = $variable_1
|| $variable_2.
The same applies to:
**=+=
> "sw" == shawn wilson writes:
RD> Perl has no proper boolean values. Instead, the boolean operators
RD> treat zero, undef, and the null string '' all as false. Anything else
RD> is true.
sw> to be pedantic, '0' is also false. it isn't exactly the same as 0.
sw> come again with t
RD> Perl has no proper boolean values. Instead, the boolean operators
RD> treat zero, undef, and the null string '' all as false. Anything else
RD> is true.
to be pedantic, '0' is also false. it isn't exactly the same as 0.
come again with that? how is:
$string = 0; #different from
$string =
1 - 100 of 497 matches
Mail list logo