Re: variable help

2008-03-04 Thread Chas. Owens
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

Re: variable help

2008-03-04 Thread yitzle
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

Re: variable help

2008-03-04 Thread Chas. Owens
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

Re: variable help

2008-03-04 Thread yitzle
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

Re: variable help

2008-03-04 Thread Chas. Owens
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

Re: variable help

2008-03-04 Thread MK
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

Re: variable help

2008-03-04 Thread Dr.Ruud
[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. $

Re: variable help

2008-03-04 Thread yitzle
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

Re: variable help

2008-03-04 Thread Chas. Owens
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

RE: variable help

2008-03-04 Thread Andrew Curry
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

Re: variable help

2008-03-04 Thread Randal L. Schwartz
> "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

Re: variable help

2008-03-04 Thread Chas. Owens
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

Re: variable help

2008-03-04 Thread Randal L. Schwartz
> ""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

Re: variable help

2008-03-04 Thread Randal L. Schwartz
> ""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

RE: variable help

2008-03-04 Thread Andrew Curry
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

RE: variable help

2008-03-04 Thread Andrew Curry
} 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

Re: variable help

2008-03-04 Thread John W. Krahn
[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

RE: variable help

2008-03-04 Thread Irfan.Sayed
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

RE: variable help

2008-03-04 Thread Irfan.Sayed
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"; }

Re: variable help

2008-03-04 Thread yitzle
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

Re: variable help

2008-03-04 Thread Rodrick Brown
#!/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