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: Validating xml file against xsd

2008-03-04 Thread Dr.Ruud
"perl pra" schreef: > I wanted to validate xml file against specified xsd file. > Is there any perl module which does this? Try XML::Compile "The schema is not strictly validated. In many cases, compile-time errors will get reported. On the other hand, the processed data is strictly validated ag

Re: comparing some but not all fields in lists

2008-03-04 Thread Jay Savage
On Mon, Mar 3, 2008 at 5:32 PM, David Newman <[EMAIL PROTECTED]> wrote: > Greetings. I'm looking to compare two contact lists in csv format, and > then print out "here are the records in in Llist only, in Rlist only, > and what's in common." > > I should compare only 3 of the 82 fields in each l

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
True enough however please don't be so rude, people should be free to post the answers they think if only to be corrected and learn, and not be scared off by know by flippant replies. You are correct it will return a false positive as will $x=~/^[0-9]*$/ for that matter. But its an ultra simple so

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
Correction its not that it's a string (which it is) its that int doesn't like 0 even thought it's an integer by definition. -Original Message- From: Andrew Curry [mailto:[EMAIL PROTECTED] Sent: 04 March 2008 20:52 To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Cc: beginners@perl.org Subject: RE

RE: variable help

2008-03-04 Thread Andrew Curry
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 whole set of numbers { 1,2,3} or negative whole nu

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
Thanks. Can you please explain the reg. expression in more detail. Please --Irfan. Project Lead TSINDIA - Production Line Individual Software Solutions - UMO T-Systems India Private Limited, Pune Telephone: +91-20-30245000/25605000 (Extn: 5271) Mobile: +91 9822 854 227 Fax: ++91-020 25674090

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"; } ~ On Tue,

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

variable help

2008-03-04 Thread Irfan.Sayed
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 whether that value is string or integer. Please help Regards Irfan.

Re: comparing some but not all fields in lists

2008-03-04 Thread Gunnar Hjalmarsson
(Randal L. Schwartz) wrote: "Gunnar" == Gunnar Hjalmarsson <[EMAIL PROTECTED]> writes: Gunnar> my ($comp) = /([^,]*,[^,]*,[^,]*)/; Gunnar> $Llist{$comp} = $_; These lines scare me. What happens if the regex fails? And if you never expect it to fail, at least add a "die", to p