Dr.Ruud wrote:
> Rob Dixon schreef:
>
>> - Forcing a conversion to a string or a numeric is easy in Perl, using
>>
>> $val.''
>> or
>> $val+0
>>
>> respectively.
>
> For my needs (which includes mod_perl) this is not complete. Having all
> three personalities IOK/NOK/POK active at the
Rob Dixon schreef:
> - Forcing a conversion to a string or a numeric is easy in Perl, using
>
> $val.''
> or
> $val+0
>
> respectively.
For my needs (which includes mod_perl) this is not complete. Having all
three personalities IOK/NOK/POK active at the same time before forking,
saves
Dr.Ruud wrote:
>
> Rob Dixon schreef:
>>
>> Dr.Ruud wrote:
>>>
>>> Rob Dixon wrote:
A scalar cannot have multiple 'personalities' - it can have a
maximum of two (its inherent type and a string equivalent) at any
one time, but usually has only one.
>>>
>>> It can at least have
William wrote:
>> use strict;
>> use warnings;
>>
>> use Devel::Peek qw/Dump/;
>>
>> my $numstr = sprintf("%4d", 1234);
>> Dump $numstr;
>>
>> $numstr = sprintf("%05d", 1234);
>> Dump $numstr;
>>
>> my $num = sprintf("%05d", 1234);
>> $num += 0;
>> Dump $num;
>>
>> **OUTPUT**
>>
>> SV = PV(0x365ec)
Rob Dixon schreef:
> Dr.Ruud:
>> Rob Dixon:
>>> A scalar cannot have multiple 'personalities' - it can have a
>>> maximum of two (its inherent type and a string equivalent) at any
>>> one time, but usually has only one.
>>
>> It can at least have 3: an integer numeric one, a floating numeric
>> on
Dr.Ruud wrote:
> Rob Dixon schreef:
>
>>> Maybe the other modules that you use, have Data::Dumper embedded?
>> [...]
>>
>> Now I've been specific: all of those things were untrue.
>
> What can be wrong about a "maybe"?
We're not talking about 'maybe there is a God' here, this is 'maybe pigs fly
Dr.Ruud wrote:
> Rob Dixon schreef:
>> Dr.Ruud:
>
>>> There is no real way to test if a value inside a variable has a
>>> numeric "personality". [...]
>> There is indeed a simple way to test in Perl whether a scalar value
>> is being treated as a string
>
> I stated something about numeric, you a
Dr.Ruud wrote:
> Rob Dixon schreef:
>
>> A scalar cannot have multiple 'personalities' - it can have a maximum
>> of two (its inherent type and a string equivalent) at any one time,
>> but usually has only one.
>
> It can at least have 3: an integer numeric one, a floating numeric one,
> and a st
Rob Dixon schreef:
>> Maybe the other modules that you use, have Data::Dumper embedded?
> [...]
>
> Now I've been specific: all of those things were untrue.
What can be wrong about a "maybe"?
--
Affijn, Ruud
"Gewoon is een tijger."
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additiona
Rob Dixon schreef:
> Dr.Ruud:
>> There is no real way to test if a value inside a variable has a
>> numeric "personality". [...]
>
> There is indeed a simple way to test in Perl whether a scalar value
> is being treated as a string
I stated something about numeric, you about string. Do you see th
Rob Dixon schreef:
> A scalar cannot have multiple 'personalities' - it can have a maximum
> of two (its inherent type and a string equivalent) at any one time,
> but usually has only one.
It can at least have 3: an integer numeric one, a floating numeric one,
and a string one. It can have more.
Rob Dixon schreef:
> Dr.Ruud:
>> Rob Dixon:
>> I am not sure which of the above you consider not true, so I'll show
>> it with a variant of your own code.
>
> without there being any 'above'.
Nonsense. I left exactly what I assumed you meant with your "That is not
true.". That is a basic function
On Jun 15, 10:09 pm, [EMAIL PROTECTED] (William) wrote:
> Hello, if I use the sprintf function it would give me a number STRING, but
> not number, so I have to trick the string to become number by adding and
> subtracting the number with 1. Is there a better way than this ? I want it to
> be a n
> use strict;
> use warnings;
>
> use Devel::Peek qw/Dump/;
>
> my $numstr = sprintf("%4d", 1234);
> Dump $numstr;
>
> $numstr = sprintf("%05d", 1234);
> Dump $numstr;
>
> my $num = sprintf("%05d", 1234);
> $num += 0;
> Dump $num;
>
> **OUTPUT**
>
> SV = PV(0x365ec) at 0x3652c
> REFCNT = 1
Dr.Ruud wrote:
> Rob Dixon schreef:
>
>> Please try to quote relevant parts of the posts you respond to
>> in future.
>
> I did, and I always do, and I'm proud of it. :)
I think that is a matter of opinion, and mine is that you do not. For instance,
no one has any idea what I said to prompt t
Rob Dixon schreef:
> Dr.Ruud:
>> Rob Dixon:
>>> Dr.Ruud:
That Data::Dumper prefers to print the numeric face of the
variable, if available, is a matter of choice inside the code of
Data::Dumper. Maybe the other modules that you use, have
Data::Dumper embedded?
>>>
>>> That is n
Rob Dixon schreef:
> Please try to quote relevant parts of the posts you respond to
> in future.
I did, and I always do, and I'm proud of it. :)
Next time you write "That is not true.", be specific!
--
Affijn, Ruud
"Gewoon is een tijger."
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For
Dr.Ruud wrote:
> Rob Dixon schreef:
>> Dr.Ruud wrote:
>
>>> That Data::Dumper prefers to print the numeric face of the variable,
>>> if available, is a matter of choice inside the code of Data::Dumper.
>>> Maybe the other modules that you use, have Data::Dumper embedded?
>>
>> That is not true.
>
William schreef:
>> Testing with a numeric operator also "works", see below:
>>
>> $ perl -Mstrict -Mwarnings -MData::Dumper -wle'
>>my $s = "1234";
>>print Dumper($s);
>>print 1 if $s == 0;
>>print Dumper($s);
>>print 2 if $s eq "1234";
>>print Dumper($s);
>> '
>> $VAR1 =
Rob Dixon schreef:
> Dr.Ruud wrote:
>> That Data::Dumper prefers to print the numeric face of the variable,
>> if available, is a matter of choice inside the code of Data::Dumper.
>> Maybe the other modules that you use, have Data::Dumper embedded?
>
> That is not true.
I am not sure which of the
> Testing with a numeric operator also "works", see below:
>
> $ perl -Mstrict -Mwarnings -MData::Dumper -wle'
>my $s = "1234";
>print Dumper($s);
>print 1 if $s == 0;
>print Dumper($s);
>print 2 if $s eq "1234";
>print Dumper($s);
> '
> $VAR1 = '1234';
>
> $VAR1 = 1234;
>
Dr.Ruud wrote:
> William schreef:
>> [*attribution dammit*] Ruud:
>
>>> There is no real way to test if a value inside a variable has a
>>> numeric "personality". Variables can have multiple "personalities",
>>> each with there own binary value.
>>>
>>> So maybe the problem just comes from the lea
William schreef:
> [*attribution dammit*] Ruud:
>> There is no real way to test if a value inside a variable has a
>> numeric "personality". Variables can have multiple "personalities",
>> each with there own binary value.
>>
>> So maybe the problem just comes from the leading zeroes that your
>>
> There is no real way to test if a value inside a variable has a numeric
> "personality". Variables can have multiple "personalities", each with
> there own binary value.
>
> So maybe the problem just comes from the leading zeroes that your
> sprintf format added?
Not exactly from the leading z
William schreef:
> [attribution dammit] Ruud:
>> my $number = 0+ $strNumber;
>>
>> or "in place":
>>
>> $strNumber += 0;
>>
>> But there really is no need! The first time you use the variable as a
>> number, it will become a number (or rather a numeric reality will be
>> added to it), whic
> my $number = 0+ $strNumber;
>
> or "in place":
>
> $strNumber += 0;
>
> But there really is no need! The first time you use the variable as a
> number, it will become a number (or rather a numeric reality will be
> added to it), which is used in further numeric contexts
haha instead o
William schreef:
> Hello, if I use the sprintf function it would give me a number
> STRING, but not number, so I have to trick the string to become
> number by adding and subtracting the number with 1. Is there a better
> way than this ? I want it to be a number data type and not string.
>
> e.g
>
On Sun, Jun 15, 2008 at 8:09 PM, William <[EMAIL PROTECTED]> wrote:
>
> my $strNumber = sprintf("%04d", 123);
instead of that, you would say:
my $strNumber = sprintf("%d", 123);
This is already a number.
--
Jeff Peng - [EMAIL PROTECTED]
Professional Squid supports in China
http://www.ChinaSqu
Hello, if I use the sprintf function it would give me a number STRING, but not
number, so I have to trick the string to become number by adding and
subtracting the number with 1. Is there a better way than this ? I want it to
be a number data type and not string.
e.g
my $strNumber = sprintf("
29 matches
Mail list logo