On Tue, Mar 4, 2008 at 11:18 PM, yitzle <[EMAIL PROTECTED]> wrote:
> On Tue, Mar 4, 2008 at 10:35 PM, Chas. Owens <[EMAIL PROTECTED]> wrote:
> > A terminal that can handle UTF-8.
> >
> > You may need to put this in your profile
> > #fix UTF-8 support
> > export LC_CTYPE=en_US.UTF-8 #vim ne
On Tue, Mar 4, 2008 at 10:35 PM, Chas. Owens <[EMAIL PROTECTED]> wrote:
> A terminal that can handle UTF-8.
>
> You may need to put this in your profile
> #fix UTF-8 support
> export LC_CTYPE=en_US.UTF-8 #vim needs this to swtich it from Latin1 to UTF-8
> export PERL_UNICODE=SDL #Makes Per
On Tue, Mar 4, 2008 at 10:23 PM, yitzle <[EMAIL PROTECTED]> wrote:
> On Tue, Mar 4, 2008 at 8:29 PM, Chas. Owens <[EMAIL PROTECTED]> wrote:
> > Nope, due to addition of Unicode support in recent versions of Perl it
> > will also match "\x{1814}" the Mongolian digit 4. The \d character
> > cl
On Tue, Mar 4, 2008 at 8:29 PM, Chas. Owens <[EMAIL PROTECTED]> wrote:
> Nope, due to addition of Unicode support in recent versions of Perl it
> will also match "\x{1814}" the Mongolian digit 4. The \d character
> class is not the same as [0-9], it matches all number characters,
> including t
On Tue, Mar 4, 2008 at 8:06 PM, MK <[EMAIL PROTECTED]> wrote:
> On 03/04/2008 03:41:44 PM, yitzle wrote:
>
> -> I'd use a RegEx and test to see if the string is made up entirely of
>
> -> integers.
> -> print "The variable containing $p is an interger\n" if ($p =~
> -> /^[0-9]+$/);
>
> yitzle
On 03/04/2008 03:41:44 PM, yitzle wrote:
-> I'd use a RegEx and test to see if the string is made up entirely of
-> integers.
-> print "The variable containing $p is an interger\n" if ($p =~
-> /^[0-9]+$/);
yitzle would seem to have the most foolproof solution. The only
problem would be if
[EMAIL PROTECTED] schreef:
> How to find out the specific variable contains integer value. In my
> script ,variable is storing some value but I want to find out whether
> that value is string or integer.
In Perl, data types are like scalar, array, hash. Operator types are
like numeric, string.
$
Andrew has got a good point. The perldoc page says:
if (/^\d+$/) { print "is a whole number\n" }
which would indicate that the author of the perldoc page believes
"123\n" should classify as a number, while "123foo" shouldn't, even
though Perl sometimes treats "123foo" as a number.
I was going to
On Tue, Mar 4, 2008 at 4:44 PM, Randal L. Schwartz
<[EMAIL PROTECTED]> wrote:
> > ""Andrew" == "Andrew Curry" <[EMAIL PROTECTED]> writes:
>
> "Andrew> If you are not 100% sure then you can also do if ($x =~/^\d*$/) for
> an
> "Andrew> actual integer i.e. a number in the positive whole set of
can use
Scalar::Util but most people just want a simple test.
-Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: 04 March 2008 21:45
To: beginners@perl.org
Subject: Re: variable help
>>>>> ""Andrew" == "Andrew Curry" <[EM
> "Chas" == Chas Owens <[EMAIL PROTECTED]> writes:
Chas> I cannot disagree with this sentiment more. Bad answers offer the
Chas> chance to teach more than one person at a time. People should not be
Chas> afraid to post answers to this list; however, it is a good idea to
Chas> test your answe
On Tue, Mar 4, 2008 at 4:43 PM, Randal L. Schwartz
<[EMAIL PROTECTED]> wrote:
snip
> And you might want to note that submitting a *bad* answer to the beginners
> mailing list is worse than submitting *no* answer, because it means that the
> resources of People With More Experience Than You now h
> ""Andrew" == "Andrew Curry" <[EMAIL PROTECTED]> writes:
"Andrew> If you are not 100% sure then you can also do if ($x =~/^\d*$/) for an
"Andrew> actual integer i.e. a number in the positive whole set of numbers {
"Andrew> 1,2,3} or negative whole numbers -1,-2,-3 or 0.
This also f
> ""Rodrick" == "Rodrick Brown" <[EMAIL PROTECTED]> writes:
"Rodrick> #!/usr/bin/perl
"Rodrick> my $p = 10;
"Rodrick> if( int($p) ) {
"Rodrick> print "$p is an interger\n";
"Rodrick> }
"Rodrick> ~
Not even close.
$ perldoc -f int
int EXPR
int Returns the integer portion of EXP
erl.org
Subject: RE: variable help
Be warned though that int isn't cleaver enough to deal with say...
$x='0';
print int($x);
still says it's a string as It is.
If you are not 100% sure then you can also do if ($x =~/^\d*$/) for an
actual integer i.e. a number in the positive wh
} or negative whole numbers -1,-2,-3 or 0.
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: 04 March 2008 20:42
To: [EMAIL PROTECTED]
Cc: beginners@perl.org
Subject: RE: variable help
Thanks Brown. It worked.
-Original Message-
From: Rodrick
[EMAIL PROTECTED] wrote:
Hi All,
Hello,
How to find out the specific variable contains integer value. In my
script ,variable is storing some value but I want to find out whether
that value is string or integer.
perldoc -q integer
Also look for the function looks_like_number() in:
perldoc
Internet: http://www.t-systems.com
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of yitzle
Sent: Wednesday, March 05, 2008 2:12 AM
To: Rodrick Brown
Cc: Sayed, Irfan; beginners@perl.org
Subject: Re: variable help
This approach does not consider "0&q
Thanks Brown. It worked.
-Original Message-
From: Rodrick Brown [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 05, 2008 1:50 AM
To: Sayed, Irfan
Cc: beginners@perl.org
Subject: Re: variable help
#!/usr/bin/perl
my $p = 10;
if( int($p) ) {
print "$p is an interger\n";
}
This approach does not consider "0" to be an integer.
I'd use a RegEx and test to see if the string is made up entirely of integers.
print "The variable containing $p is an interger\n" if ($p =~ /^[0-9]+$/);
On Tue, Mar 4, 2008 at 3:19 PM, Rodrick Brown <[EMAIL PROTECTED]> wrote:
> #!/usr/bin/pe
#!/usr/bin/perl
my $p = 10;
if( int($p) ) {
print "$p is an interger\n";
}
~
On Tue, Mar 4, 2008 at 3:16 PM, <[EMAIL PROTECTED]> wrote:
> Hi All,
>
>
>
> How to find out the specific variable contains integer value. In my
> script ,variable is storing some value but I want to find out whethe
21 matches
Mail list logo